2017-10-18 01:51:41 +02:00
|
|
|
# This test runs netdata and checks for data via apps.plugin
|
|
|
|
|
|
|
|
import ./make-test.nix ({ pkgs, ...} : {
|
|
|
|
name = "netdata";
|
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ cransom ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
netdata =
|
2018-07-20 22:56:59 +02:00
|
|
|
{ pkgs, ... }:
|
2017-10-18 01:51:41 +02:00
|
|
|
{
|
|
|
|
environment.systemPackages = with pkgs; [ curl jq ];
|
|
|
|
services.netdata.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$netdata->waitForUnit("netdata.service");
|
2018-08-05 00:05:48 +02:00
|
|
|
|
2018-08-26 13:38:58 +02:00
|
|
|
# wait for the service to listen before sending a request
|
|
|
|
$netdata->waitForOpenPort(19999);
|
|
|
|
|
2018-08-05 00:05:48 +02:00
|
|
|
# check if the netdata main page loads.
|
|
|
|
$netdata->succeed("curl --fail http://localhost:19999/");
|
|
|
|
|
|
|
|
# check if netdata can read disk ops for root owned processes.
|
|
|
|
# if > 0, successful. verifies both netdata working and
|
2017-10-18 01:51:41 +02:00
|
|
|
# apps.plugin has elevated capabilities.
|
|
|
|
my $cmd = <<'CMD';
|
|
|
|
curl -s http://localhost:19999/api/v1/data\?chart=users.pwrites | \
|
|
|
|
jq -e '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0'
|
|
|
|
CMD
|
|
|
|
$netdata->waitUntilSucceeds($cmd);
|
|
|
|
'';
|
|
|
|
})
|