mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
Merge pull request #172084 from priegger/prometheus-statsd-exporter
This commit is contained in:
commit
bf46d7b626
@ -68,6 +68,7 @@ let
|
||||
"smartctl"
|
||||
"smokeping"
|
||||
"sql"
|
||||
"statsd"
|
||||
"surfboard"
|
||||
"systemd"
|
||||
"tor"
|
||||
|
@ -0,0 +1,19 @@
|
||||
{ config, lib, pkgs, options }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.statsd;
|
||||
in
|
||||
{
|
||||
port = 9102;
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-statsd-exporter}/bin/statsd_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -1172,6 +1172,25 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
statsd = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
};
|
||||
exporterTest = ''
|
||||
wait_for_unit("prometheus-statsd-exporter.service")
|
||||
wait_for_open_port(9102)
|
||||
succeed("curl http://localhost:9102/metrics | grep 'statsd_exporter_build_info{'")
|
||||
succeed(
|
||||
"echo 'test.udp:1|c' > /dev/udp/localhost/9125",
|
||||
"curl http://localhost:9102/metrics | grep 'test_udp 1'",
|
||||
)
|
||||
succeed(
|
||||
"echo 'test.tcp:1|c' > /dev/tcp/localhost/9125",
|
||||
"curl http://localhost:9102/metrics | grep 'test_tcp 1'",
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
surfboard = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
Loading…
Reference in New Issue
Block a user