at 23.05-pre 1.1 kB view raw
1import ./make-test-python.nix ({ pkgs, ... }: { 2 name = "collectd"; 3 meta = { }; 4 5 nodes.machine = 6 { pkgs, lib, ... }: 7 8 { 9 services.collectd = { 10 enable = true; 11 extraConfig = lib.mkBefore '' 12 Interval 30 13 ''; 14 plugins = { 15 rrdtool = '' 16 DataDir "/var/lib/collectd/rrd" 17 ''; 18 load = ""; 19 }; 20 }; 21 environment.systemPackages = [ pkgs.rrdtool ]; 22 }; 23 24 testScript = '' 25 machine.wait_for_unit("collectd.service") 26 hostname = machine.succeed("hostname").strip() 27 file = f"/var/lib/collectd/rrd/{hostname}/load/load.rrd" 28 machine.wait_for_file(file); 29 machine.succeed(f"rrdinfo {file} | logger") 30 # check that this file contains a shortterm metric 31 machine.succeed(f"rrdinfo {file} | grep -F 'ds[shortterm].min = '") 32 # check that interval was set before the plugins 33 machine.succeed(f"rrdinfo {file} | grep -F 'step = 30'") 34 # check that there are frequent updates 35 machine.succeed(f"cp {file} before") 36 machine.wait_until_fails(f"cmp before {file}") 37 ''; 38})