summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/services/monitoring/graphite.nix27
-rw-r--r--pkgs/top-level/python-packages.nix20
2 files changed, 46 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index bbbbcbccb9be..2a572a6a065c 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -354,6 +354,16 @@ in {
         type = types.lines;
       };
     };
+
+    beacon = {
+      enable = mkEnableOption "Whether to enable graphite beacon.";
+
+      config = mkOption {
+        description = "Graphite beacon configuration.";
+        default = {};
+        type = types.attrs;
+      };
+    };
   };
 
   ###### implementation
@@ -535,10 +545,25 @@ in {
       environment.systemPackages = [ pkgs.pythonPackages.graphite_pager ];
     })
 
+    (mkIf cfg.beacon.enable {
+      systemd.services.graphite-beacon = {
+        description = "Grpahite Beacon Alerting Daemon";
+        wantedBy = [ "multi-user.target" ];
+        serviceConfig = {
+          ExecStart = ''
+            ${pkgs.pythonPackages.graphite_beacon}/bin/graphite-beacon \
+              --config ${pkgs.writeText "graphite-beacon.json" (builtins.toJSON cfg.beacon.config)}
+          '';
+          User = "graphite";
+          Group = "graphite";
+        };
+      };
+    })
+
     (mkIf (
       cfg.carbon.enableCache || cfg.carbon.enableAggregator || cfg.carbon.enableRelay ||
       cfg.web.enable || cfg.api.enable ||
-      cfg.seyren.enable || cfg.pager.enable
+      cfg.seyren.enable || cfg.pager.enable || cfg.beacon.enable
      ) {
       users.extraUsers = singleton {
         name = "graphite";
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 604f6a91c430..c324ae1c00c7 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -14740,6 +14740,26 @@ let
     };
   };
 
+  graphite_beacon = buildPythonPackage rec {
+    name = "graphite_beacon-0.22.1";
+
+    src = pkgs.fetchurl {
+      url = "https://pypi.python.org/packages/source/g/graphite_beacon/${name}.tar.gz";
+      md5 = "3d7b2bf8a41b6c3ec5ba2c14db321096";
+    };
+
+    propagatedBuildInputs = [ self.tornado ];
+
+    preBuild = "> requirements.txt";
+
+    meta = {
+      description = "A simple alerting application for Graphite metrics";
+      homepage = https://github.com/klen/graphite-beacon;
+      maintainers = [ maintainers.offline ];
+      license = licenses.mit;
+    };
+  };
+
   graphite_influxdb = buildPythonPackage rec {
     name = "graphite-influxdb-0.3";