monitoring: build fs list from config

This commit is contained in:
Aaron Bieber 2023-03-29 09:00:55 -06:00
parent ae835019bd
commit 7db769a19a
No known key found for this signature in database
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,9 @@
{ config, ... }:
let
inherit (builtins)
readFile concatStringsSep attrValues mapAttrs replaceStrings;
{
in {
config = {
sops.secrets = {
monit_cfg = {
@ -11,7 +14,12 @@
};
services.monit = {
enable = true;
config = builtins.readFile ./monitrc;
config = readFile ./monitrc + (concatStringsSep "\n" (attrValues (mapAttrs
(f: _: ''
check filesystem ${replaceStrings [ "/" ] [ "_" ] f} with path ${f}
if space usage > 90% then alert
if inode usage > 90% then alert
'') config.fileSystems)));
};
};
}

View File

@ -20,6 +20,3 @@ check system $HOST
if cpu usage (wait) > 80% for 2 cycles then alert
if cpu usage > 200% for 4 cycles then alert
check filesystem rootfs with path /
if space usage > 90% then alert
if inode usage > 90% then alert