1 # This test runs netdata and checks for data via apps.plugin
3 import ./make-test-python.nix ({ pkgs, ...} : {
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ cransom raitobezarius ];
13 environment.systemPackages = with pkgs; [ curl jq netdata ];
14 services.netdata.enable = true;
21 netdata.wait_for_unit("netdata.service")
23 # wait for the service to listen before sending a request
24 netdata.wait_for_open_port(19999)
26 # check if the netdata main page loads.
27 netdata.succeed("curl --fail http://localhost:19999/")
28 netdata.succeed("sleep 4")
30 # check if netdata can read disk ops for root owned processes.
31 # if > 0, successful. verifies both netdata working and
32 # apps.plugin has elevated capabilities.
33 url = "http://localhost:19999/api/v1/data\?chart=user.root_disk_physical_io"
34 filter = '[.data[range(10)][2]] | add | . < 0'
35 cmd = f"curl -s {url} | jq -e '{filter}'"
36 netdata.wait_until_succeeds(cmd)
38 # check if the control socket is available
39 netdata.succeed("sudo netdatacli ping")