nixpkgs/nixos/tests/telegraf.nix

31 lines
756 B
Nix
Raw Normal View History

2019-11-06 14:40:43 +03:00
import ./make-test-python.nix ({ pkgs, ...} : {
2019-01-21 14:30:11 +03:00
name = "telegraf";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ mic92 ];
};
machine = { ... }: {
services.telegraf.enable = true;
services.telegraf.extraConfig = {
agent.interval = "1s";
agent.flush_interval = "1s";
inputs.exec = {
commands = [
"${pkgs.runtimeShell} -c 'echo example,tag=a i=42i'"
];
timeout = "5s";
data_format = "influx";
};
outputs.file.files = ["/tmp/metrics.out"];
outputs.file.data_format = "influx";
};
};
testScript = ''
2019-11-06 14:40:43 +03:00
start_all()
2019-01-21 14:30:11 +03:00
2019-11-06 14:40:43 +03:00
machine.wait_for_unit("telegraf.service")
machine.wait_until_succeeds("grep -q example /tmp/metrics.out")
2019-01-21 14:30:11 +03:00
'';
})