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 ];
16 python.recommendedPythonPackages = true;
24 netdata.wait_for_unit("netdata.service")
26 # wait for the service to listen before sending a request
27 netdata.wait_for_open_port(19999)
29 # check if the netdata main page loads.
30 netdata.succeed("curl --fail http://localhost:19999/")
31 netdata.succeed("sleep 4")
33 # check if netdata can read disk ops for root owned processes.
34 # if > 0, successful. verifies both netdata working and
35 # apps.plugin has elevated capabilities.
36 url = "http://localhost:19999/api/v1/data\?chart=user.root_disk_physical_io"
37 filter = '[.data[range(10)][2]] | add | . < 0'
38 cmd = f"curl -s {url} | jq -e '{filter}'"
39 netdata.wait_until_succeeds(cmd)
41 # check if the control socket is available
42 netdata.succeed("sudo netdatacli ping")