diff options
author | WilliButz <WilliButz@users.noreply.github.com> | 2020-06-18 11:25:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-18 11:25:23 +0200 |
commit | 57a3249994d29e2bec3a526e1ed4564ed6daa1a9 (patch) | |
tree | 1a5e1a7181ddbdf20a8d27f07cffdd19130af5a0 /nixos | |
parent | 977a349dc70f5108431e232e6ac4e10dab9bcd91 (diff) | |
parent | 344e64a4d970a180fc0bc1054cb5fd503dc1daa8 (diff) |
Merge pull request #90662 from srhb/redis-exporter
prometheus-redis-exporter: init at 1.7.0
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/redis.nix | 19 | ||||
-rw-r--r-- | nixos/tests/prometheus-exporters.nix | 14 |
3 files changed, 34 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 0318acae50f70..29f402b212fe3 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -39,6 +39,7 @@ let "node" "postfix" "postgres" + "redis" "rspamd" "snmp" "surfboard" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/redis.nix b/nixos/modules/services/monitoring/prometheus/exporters/redis.nix new file mode 100644 index 0000000000000..befbcb21f7664 --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/redis.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, options }: + +with lib; + +let + cfg = config.services.prometheus.exporters.redis; +in +{ + port = 9121; + serviceOpts = { + serviceConfig = { + ExecStart = '' + ${pkgs.prometheus-redis-exporter}/bin/redis_exporter \ + -web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ + ${concatStringsSep " \\\n " cfg.extraFlags} + ''; + }; + }; +} diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 4dbd64312224e..75c4ca12db24d 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -475,6 +475,20 @@ let ''; }; + redis = { + exporterConfig = { + enable = true; + }; + metricProvider.services.redis.enable = true; + exporterTest = '' + wait_for_unit("redis.service") + wait_for_unit("prometheus-redis-exporter.service") + wait_for_open_port(6379) + wait_for_open_port(9121) + wait_until_succeeds("curl -sSf localhost:9121/metrics | grep -q 'redis_up 1'") + ''; + }; + rspamd = { exporterConfig = { enable = true; |