Skip to content

Commit

Permalink
[Backport release-24.05] nixos/telegraf: make sure ping executable is…
Browse files Browse the repository at this point in the history
… available when trying to ping (#338740)
  • Loading branch information
Artturin authored Sep 1, 2024
2 parents f26fa0a + 43e77c3 commit 891f087
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nixos/modules/services/monitoring/telegraf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ in {
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
path = lib.optional (config.services.telegraf.extraConfig.inputs ? procstat) pkgs.procps;
path = lib.optional (config.services.telegraf.extraConfig.inputs ? procstat) pkgs.procps
++ lib.optional (config.services.telegraf.extraConfig.inputs ? ping) pkgs.iputils;
serviceConfig = {
EnvironmentFile = config.services.telegraf.environmentFiles;
ExecStartPre = lib.optional (config.services.telegraf.environmentFiles != [])
Expand Down
7 changes: 7 additions & 0 deletions nixos/tests/telegraf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import ./make-test-python.nix ({ pkgs, ...} : {
timeout = "5s";
data_format = "influx";
};
inputs.ping = {
urls = ["127.0.0.1"];
count = 4;
interval = "10s";
timeout = 1.0;
};
outputs.file.files = ["/tmp/metrics.out"];
outputs.file.data_format = "influx";
};
Expand All @@ -29,5 +35,6 @@ import ./make-test-python.nix ({ pkgs, ...} : {
machine.wait_for_unit("telegraf.service")
machine.wait_until_succeeds("grep -q example /tmp/metrics.out")
machine.wait_until_succeeds("grep -q ping /tmp/metrics.out")
'';
})

0 comments on commit 891f087

Please sign in to comment.