Files
nixpkgs/nixos/modules/services/monitoring/riemann-tools.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

76 lines
1.7 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.riemann-tools;
riemannHost = "${cfg.riemannHost}";
healthLauncher = pkgs.writeScriptBin "riemann-health" ''
#!/bin/sh
exec ${pkgs.riemann-tools}/bin/riemann-health ${builtins.concatStringsSep " " cfg.extraArgs} --host ${riemannHost}
'';
in
{
options = {
services.riemann-tools = {
enableHealth = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable the riemann-health daemon.
'';
};
riemannHost = lib.mkOption {
type = lib.types.str;
default = "127.0.0.1";
description = ''
Address of the host riemann node. Defaults to localhost.
'';
};
extraArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
A list of commandline-switches forwarded to a riemann-tool.
See for example `riemann-health --help` for available options.
'';
example = [
"-p 5555"
"--timeout=30"
"--attribute=myattribute=42"
];
};
};
};
config = lib.mkIf cfg.enableHealth {
users.groups.riemanntools.gid = config.ids.gids.riemanntools;
users.users.riemanntools = {
description = "riemann-tools daemon user";
uid = config.ids.uids.riemanntools;
group = "riemanntools";
};
systemd.services.riemann-health = {
wantedBy = [ "multi-user.target" ];
path = [ pkgs.procps ];
serviceConfig = {
User = "riemanntools";
ExecStart = "${healthLauncher}/bin/riemann-health";
};
};
};
}