mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #172084 from priegger/prometheus-statsd-exporter
This commit is contained in:
commit
bf46d7b626
3 changed files with 39 additions and 0 deletions
|
@ -68,6 +68,7 @@ let
|
||||||
"smartctl"
|
"smartctl"
|
||||||
"smokeping"
|
"smokeping"
|
||||||
"sql"
|
"sql"
|
||||||
|
"statsd"
|
||||||
"surfboard"
|
"surfboard"
|
||||||
"systemd"
|
"systemd"
|
||||||
"tor"
|
"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 = {
|
surfboard = {
|
||||||
exporterConfig = {
|
exporterConfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue