ram check, configurable loglevel

This commit is contained in:
Alex Tau 2025-05-13 14:15:56 +03:00
parent 5095057a13
commit da85a566c4
10 changed files with 180 additions and 18 deletions

View file

@ -30,6 +30,7 @@ package:
serviceConfigFile = json.generate "config.json" {
enabled_check_sets = cfg.enabledCheckSets;
log_level = cfg.logLevel;
telegram = with cfg.telegram; {
creds_secret_path = credsSecretPath;
room_id = roomId;
@ -54,6 +55,11 @@ package:
warning_percentage = warningPercentage;
critical_percentage = criticalPercentage;
};
ram = with cfg.checks.ram; {
warning_percentage = warningPercentage;
critical_percentage = criticalPercentage;
};
};
};
in lib.mkIf cfg.enable {

View file

@ -11,12 +11,27 @@ in
options.services.lego-monitoring = {
enable = lib.mkEnableOption "lego-monitoring service";
logLevel = lib.mkOption {
type = lib.types.enum [
"CRITICAL"
"ERROR"
"WARNING"
"INFO"
"DEBUG"
];
default = "INFO";
description = "Level of logging. INFO generates a log message with every check.";
};
enabledCheckSets = lib.mkOption {
type = lib.types.listOf (lib.types.enum [
"start"
"stop"
"temp"
"cpu"
"ram"
"temp"
"vulnix"
]);
default = [ ];
@ -82,7 +97,7 @@ in
warningPercentage = lib.mkOption {
type = lib.types.nullOr lib.types.float;
default = 80.0;
description = "CPU load percentage for a warning alert is sent. Null means never generate a CPU warning alert.";
description = "CPU load percentage for a warning alert to be sent. Null means never generate a CPU warning alert.";
};
criticalPercentage = lib.mkOption {
type = lib.types.nullOr lib.types.float;
@ -90,6 +105,19 @@ in
description = "CPU load percentage for a critical alert to be sent. Null means never generate a CPU critical alert.";
};
};
ram = {
warningPercentage = lib.mkOption {
type = lib.types.nullOr lib.types.float;
default = 80.0;
description = "RAM usage percentage for a warning alert to be sent. Null means never generate a RAM warning alert.";
};
criticalPercentage = lib.mkOption {
type = lib.types.nullOr lib.types.float;
default = 90.0;
description = "RAM usage percentage for a critical alert to be sent. Null means never generate a RAM critical alert.";
};
};
};
};
}