1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-21 08:59:20 +03:00
nixpkgs/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix

62 lines
1.7 KiB
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}:
2020-02-01 15:02:58 +01:00
let
cfg = config.services.prometheus.xmpp-alerts;
settingsFormat = pkgs.formats.yaml { };
2021-04-29 23:30:36 +02:00
configFile = settingsFormat.generate "prometheus-xmpp-alerts.yml" cfg.settings;
2020-02-01 15:02:58 +01:00
in
{
2021-04-29 23:30:36 +02:00
imports = [
(lib.mkRenamedOptionModule
2021-04-29 23:30:36 +02:00
[ "services" "prometheus" "xmpp-alerts" "configuration" ]
[ "services" "prometheus" "xmpp-alerts" "settings" ]
)
2021-04-29 23:30:36 +02:00
];
2020-02-01 15:02:58 +01:00
2021-04-29 23:30:36 +02:00
options.services.prometheus.xmpp-alerts = {
enable = lib.mkEnableOption "XMPP Web hook service for Alertmanager";
2020-02-01 15:02:58 +01:00
settings = lib.mkOption {
2021-04-29 23:30:36 +02:00
type = settingsFormat.type;
default = { };
2020-02-01 15:02:58 +01:00
description = ''
2021-04-29 23:30:36 +02:00
Configuration for prometheus xmpp-alerts, see
<https://github.com/jelmer/prometheus-xmpp-alerts/blob/master/xmpp-alerts.yml.example>
2021-04-29 23:30:36 +02:00
for supported values.
'';
};
2020-02-01 15:02:58 +01:00
};
config = lib.mkIf cfg.enable {
2020-02-01 15:02:58 +01:00
systemd.services.prometheus-xmpp-alerts = {
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
ExecStart = "${pkgs.prometheus-xmpp-alerts}/bin/prometheus-xmpp-alerts --config ${configFile}";
Restart = "on-failure";
DynamicUser = true;
PrivateTmp = true;
PrivateDevices = true;
ProtectHome = true;
ProtectSystem = "strict";
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
NoNewPrivileges = true;
SystemCallArchitectures = "native";
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
];
2020-02-01 15:02:58 +01:00
SystemCallFilter = [ "@system-service" ];
};
};
};
}