mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
nixos/telegraf: make sure ping executable is available when trying to ping
We need ping to be in PATH of the service otherwise it can't ping. This commit adds it, conditional on one of the inputs being a ping task.
This commit is contained in:
parent
487972dea2
commit
934a337a13
@ -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 != [])
|
||||
|
@ -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";
|
||||
};
|
||||
@ -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")
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user