diff options
author | Casey Ransom <cransom@referentiallabs.com> | 2017-10-17 19:51:41 -0400 |
---|---|---|
committer | Casey Ransom <casey@dailykos.com> | 2018-01-02 17:57:19 -0500 |
commit | f3cba4f6bb613654b74c63be4ef49a8ba675647a (patch) | |
tree | 725f5ee9a3ab934e54e0fc5dee674fab0f5c9b08 /nixos/tests/netdata.nix | |
parent | e9d5c55d01102f322b2b2a7d10f2d7335b1c968d (diff) | |
download | nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar.gz nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar.bz2 nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar.lz nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar.xz nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.tar.zst nixlib-f3cba4f6bb613654b74c63be4ef49a8ba675647a.zip |
netdata service: fix permissions for apps.plugin
apps.plugin requires capabilities for full process monitoring. with 1.9.0, netdata allows multiple directories to search for plugins and the setuid directory can be specified here. the module is backwards compatible with older configs. a test is included that verifies data gathering for the elevated privileges. one additional attribute is added to make configuration more generic than including configuration in string form.
Diffstat (limited to 'nixos/tests/netdata.nix')
-rw-r--r-- | nixos/tests/netdata.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/nixos/tests/netdata.nix b/nixos/tests/netdata.nix new file mode 100644 index 000000000000..58733c1b3379 --- /dev/null +++ b/nixos/tests/netdata.nix @@ -0,0 +1,31 @@ +# 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 = + { config, pkgs, ... }: + { + environment.systemPackages = with pkgs; [ curl jq ]; + services.netdata.enable = true; + }; + }; + + testScript = '' + startAll; + + $netdata->waitForUnit("netdata.service"); + # check if netdata can read disk ops for root owned processes. + # if > 0, successful. verifies both netdata working and + # 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); + ''; +}) |