diff options
author | Robert Pitts and Trenton Strong <dev+rbxbx+trentonstrong@projector.com> | 2015-06-30 17:16:51 -0400 |
---|---|---|
committer | Robert Pitts <rbxbxdev@gmail.com> | 2015-06-30 17:16:51 -0400 |
commit | bbb36ea0398400d34d2d5e24bb7978133efbc180 (patch) | |
tree | 87902b1092866b2681c0802ef3bb2502fa82adf2 /nixos/modules | |
parent | a612e397d8e85c2eedb131d558464c6782d03b47 (diff) | |
download | nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar.gz nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar.bz2 nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar.lz nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar.xz nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.tar.zst nixpkgs-bbb36ea0398400d34d2d5e24bb7978133efbc180.zip |
Add riemann-tools to nixpkgs
Adds package via bundlerEnv and service for Riemann health.
Diffstat (limited to 'nixos/modules')
-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 ce935915abf..c1f55da67a0 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -221,6 +221,7 @@ skydns = 197; ripple-rest = 198; nix-serve = 199; + riemanntools = 200; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -420,6 +421,7 @@ #skydns = 197; #unused #ripple-rest = 198; #unused #nix-serve = 199; #unused + riemanntools = 200; # 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 d33d3ca91d4..bc67b6bdfa6 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -233,6 +233,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; + }; + }; + + }; + +} |