some actual alerts and telegram client

This commit is contained in:
Alex Tau 2025-04-30 00:16:27 +03:00
parent f158bc3778
commit ffdd0429b3
10 changed files with 314 additions and 33 deletions

View file

@ -11,16 +11,21 @@ package:
options.services.lego-monitoring = {
enable = lib.mkEnableOption "lego-monitoring service.";
nonSecretConfigOption = lib.mkOption {
type = lib.types.str;
default = "defaultValue";
description = "An example non-secret config option.";
enabledCheckerSets = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "List of enabled checker sets. Each checker set is a module which checks something and generates alerts based on check results.";
};
configOptionSecretPath = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Path to an example secret config option.";
telegram = {
credsSecretPath = lib.mkOption {
type = lib.types.str;
description = "Path to a file containing Telegram api_id, api_hash, and bot token, separated by the `,` character.";
};
roomId = lib.mkOption {
type = lib.types.int;
description = "ID of chat where to send alerts.";
};
};
};
@ -28,8 +33,11 @@ package:
cfg = config.services.lego-monitoring;
json = pkgs.formats.json {};
serviceConfigFile = json.generate "config.json" {
non_secret_config_option = cfg.nonSecretConfigOption;
config_option_secret_path = cfg.configOptionSecretPath;
enabled_checker_sets = cfg.enabledCheckerSets;
telegram = with cfg.telegram; {
creds_secret_path = credsSecretPath;
room_id = roomId;
};
};
in lib.mkIf cfg.enable {
systemd.services.lego-monitoring = {