feat: implement centralized alerting with vmalert and Grafana, add alert rules for CPU, disk, inode, RAM usage, and host status
This commit is contained in:
27
hosts/web-arm/modules/vmalert/rules/inode_usage.nix
Normal file
27
hosts/web-arm/modules/vmalert/rules/inode_usage.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ lib, pkgs, config, ... }: # Standard module arguments
|
||||
{
|
||||
services.vmalert.rules.groups = [
|
||||
{
|
||||
name = "InodeUsageAlerts";
|
||||
rules = [
|
||||
{
|
||||
alert = "HighInodeUsage";
|
||||
expr = ''
|
||||
(
|
||||
node_filesystem_files{fstype!~"tmpfs|rootfs",mountpoint!=""} - node_filesystem_files_free{fstype!~"tmpfs|rootfs",mountpoint!=""}
|
||||
) / node_filesystem_files{fstype!~"tmpfs|rootfs",mountpoint!=""} * 100 > 80
|
||||
'';
|
||||
for = "30m";
|
||||
labels = {
|
||||
severity = "warning";
|
||||
category = "capacity";
|
||||
};
|
||||
annotations = {
|
||||
summary = "High inode usage on {{ $labels.instance }} at {{ $labels.mountpoint }}";
|
||||
description = "Inode usage on {{ $labels.instance }} for mount point {{ $labels.mountpoint }} (fstype: {{ $labels.fstype }}) has been above 80% for more than 30 minutes. Current value: {{ $value | printf \"%.2f\" }}%.";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user