diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2020-02-01 15:02:58 +0100 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2020-02-01 15:04:01 +0100 |
commit | add880c5e8c3bab373a456e78c078fa9fea2b4cd (patch) | |
tree | 5f91b030b20c37443e07ecad68989f6437b896b0 | |
parent | d3abaa51e1aeb1d058ee40082f1ad8053d65a631 (diff) |
prometheus-xmpp-alerts: init at 0.4.2
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix | 47 | ||||
-rw-r--r-- | pkgs/servers/monitoring/prometheus/xmpp-alerts.nix | 22 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 3 |
4 files changed, 73 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b6b41f6a16954..fc397de037d8d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -529,6 +529,7 @@ ./services/monitoring/prometheus/alertmanager.nix ./services/monitoring/prometheus/exporters.nix ./services/monitoring/prometheus/pushgateway.nix + ./services/monitoring/prometheus/xmpp-alerts.nix ./services/monitoring/riemann.nix ./services/monitoring/riemann-dash.nix ./services/monitoring/riemann-tools.nix 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 0000000000000..44b15cb2034c2 --- /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" ]; + }; + }; + }; +} diff --git a/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix b/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix new file mode 100644 index 0000000000000..93e6f1767ada4 --- /dev/null +++ b/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix @@ -0,0 +1,22 @@ +{ lib, fetchFromGitHub, pythonPackages }: + +pythonPackages.buildPythonApplication rec { + pname = "prometheus-xmpp-alerts"; + version = "0.4.2"; + + src = fetchFromGitHub { + owner = "jelmer"; + repo = pname; + rev = version; + sha256 = "17aq6v4ahnga82r350kx1y8i7zgikpzmwzaacj7a339kh8hxkh63"; + }; + + propagatedBuildInputs = with pythonPackages; [ slixmpp prometheus_client pyyaml ]; + + meta = { + description = "XMPP Web hook for Prometheus"; + homepage = "https://github.com/jelmer/prometheus-xmpp-alerts"; + maintainers = with lib.maintainers; [ fpletz ]; + license = with lib.licenses; [ asl20 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f676785700bb5..96997b28fb5da 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15676,6 +15676,9 @@ in prometheus-wireguard-exporter = callPackage ../servers/monitoring/prometheus/wireguard-exporter.nix { inherit (darwin.apple_sdk.frameworks) Security; }; + prometheus-xmpp-alerts = callPackages ../servers/monitoring/prometheus/xmpp-alerts.nix { + pythonPackages = python3Packages; + }; prometheus-cpp = callPackage ../development/libraries/prometheus-cpp { }; |