From b7d8d5dd30a6cdcccc15707eb56d80373366ecee Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sat, 25 Apr 2015 15:13:38 +0200 Subject: Add graphite beacon package and module --- nixos/modules/services/monitoring/graphite.nix | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'nixos/modules/services') 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"; -- cgit 1.4.1