diff options
author | Shea Levy <shea@shealevy.com> | 2015-07-01 08:44:38 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2015-07-01 08:45:33 -0400 |
commit | dd9530c819c742bb474e7846ecd3513462d848d2 (patch) | |
tree | bb8305a9d86c37bbe5d8a70694e5a3829257610f /nixos | |
parent | 145768bf9b96f2d7cd8fdc8ce9dbf3b27a713796 (diff) | |
parent | bbb36ea0398400d34d2d5e24bb7978133efbc180 (diff) | |
download | nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar.gz nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar.bz2 nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar.lz nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar.xz nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.tar.zst nixpkgs-dd9530c819c742bb474e7846ecd3513462d848d2.zip |
Merge remote-tracking branch 'projectorhq/riemann-tools'
Add riemann-tools package and service
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/ids.nix | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/riemann-tools.nix | 62 |
3 files changed, 65 insertions, 0 deletions
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 8a2cde50e1e..80d6ff20f9b 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -224,6 +224,7 @@ tvheadend = 200; uwsgi = 201; gitit = 202; + riemanntools = 203; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -426,6 +427,7 @@ #tvheadend = 200; #unused uwsgi = 201; gitit = 202; + riemanntools = 203; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 042824bc829..76ee1b7f9c6 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -234,6 +234,7 @@ ./services/monitoring/nagios.nix ./services/monitoring/riemann.nix ./services/monitoring/riemann-dash.nix + ./services/monitoring/riemann-tools.nix ./services/monitoring/scollector.nix ./services/monitoring/smartd.nix ./services/monitoring/statsd.nix diff --git a/nixos/modules/services/monitoring/riemann-tools.nix b/nixos/modules/services/monitoring/riemann-tools.nix new file mode 100644 index 00000000000..ce277f09464 --- /dev/null +++ b/nixos/modules/services/monitoring/riemann-tools.nix @@ -0,0 +1,62 @@ +{ config, pkgs, lib, ... }: + +with pkgs; +with lib; + +let + + cfg = config.services.riemann-tools; + + riemannHost = "${cfg.riemannHost}"; + + healthLauncher = writeScriptBin "riemann-health" '' + #!/bin/sh + exec ${pkgs.riemann-tools}/bin/riemann-health --host ${riemannHost} + ''; + + +in { + + options = { + + services.riemann-tools = { + enableHealth = mkOption { + type = types.bool; + default = false; + description = '' + Enable the riemann-health daemon. + ''; + }; + riemannHost = mkOption { + type = types.str; + default = "127.0.0.1"; + description = '' + Address of the host riemann node. Defaults to localhost. + ''; + }; + }; + + }; + + config = mkIf cfg.enableHealth { + + users.extraGroups.riemanntools.gid = config.ids.gids.riemanntools; + + users.extraUsers.riemanntools = { + description = "riemann-tools daemon user"; + uid = config.ids.uids.riemanntools; + group = "riemanntools"; + }; + + systemd.services.riemann-health = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "riemanntools"; + ExecStart = "${healthLauncher}/bin/riemann-health"; + PermissionsStartOnly = true; + }; + }; + + }; + +} |