nixos/prometheus-redis-exporter: init

This commit is contained in:
Sarah Brofeldt 2020-06-18 07:46:52 +02:00
parent ac3a50122b
commit 344e64a4d9
3 changed files with 34 additions and 0 deletions

View file

@ -39,6 +39,7 @@ let
"node"
"postfix"
"postgres"
"redis"
"rspamd"
"snmp"
"surfboard"

View file

@ -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}
'';
};
};
}

View file

@ -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;