about summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2020-02-01 15:02:58 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2020-02-01 15:04:01 +0100
commitadd880c5e8c3bab373a456e78c078fa9fea2b4cd (patch)
tree5f91b030b20c37443e07ecad68989f6437b896b0 /nixos/modules/services/monitoring
parentd3abaa51e1aeb1d058ee40082f1ad8053d65a631 (diff)
downloadnixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar.gz
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar.bz2
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar.lz
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar.xz
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.tar.zst
nixlib-add880c5e8c3bab373a456e78c078fa9fea2b4cd.zip
prometheus-xmpp-alerts: init at 0.4.2
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix b/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix
new file mode 100644
index 000000000000..44b15cb2034c
--- /dev/null
+++ b/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.prometheus.xmpp-alerts;
+
+  configFile = pkgs.writeText "prometheus-xmpp-alerts.yml" (builtins.toJSON cfg.configuration);
+
+in
+
+{
+  options.services.prometheus.xmpp-alerts = {
+
+    enable = mkEnableOption "XMPP Web hook service for Alertmanager";
+
+    configuration = mkOption {
+      type = types.attrs;
+      description = "Configuration as attribute set which will be converted to YAML";
+    };
+
+  };
+
+  config = mkIf cfg.enable {
+    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" ];
+        SystemCallFilter = [ "@system-service" ];
+      };
+    };
+  };
+}