Skip to content

Commit

Permalink
nixos/netdata: copy apps_groups.conf instead of symlink (NixOS#356313)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Dec 23, 2024
2 parents 403eb36 + a61e43e commit 694f499
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/services/monitoring/netdata.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let
mkdir $out
${lib.concatStringsSep "\n" (lib.mapAttrsToList (path: file: ''
mkdir -p "$out/$(dirname ${path})"
ln -s "${file}" "$out/${path}"
${if path == "apps_groups.conf" then "cp" else "ln -s"} "${file}" "$out/${path}"
'') cfg.configDir)}
'';

Expand Down
14 changes: 13 additions & 1 deletion nixos/tests/netdata.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import ./make-test-python.nix ({ pkgs, ...} : {
services.netdata = {
enable = true;
python.recommendedPythonPackages = true;

configDir."apps_groups.conf" = pkgs.writeText "apps_groups.conf" ''
netdata_test: netdata
'';
};
};
};
Expand All @@ -33,12 +37,20 @@ import ./make-test-python.nix ({ pkgs, ...} : {
# check if netdata can read disk ops for root owned processes.
# if > 0, successful. verifies both netdata working and
# apps.plugin has elevated capabilities.
url = "http://localhost:19999/api/v1/data\?chart=user.root_disk_physical_io"
url = "http://localhost:19999/api/v1/data?chart=user.root_disk_physical_io"
filter = '[.data[range(10)][2]] | add | . < 0'
cmd = f"curl -s {url} | jq -e '{filter}'"
netdata.wait_until_succeeds(cmd)
# check if the control socket is available
netdata.succeed("sudo netdatacli ping")
# check that custom groups in apps_groups.conf are used.
# if > 0, successful. verifies that user-specified apps_group.conf
# is used.
url = "http://localhost:19999/api/v1/data?chart=app.netdata_test_cpu_utilization"
filter = '[.data[range(10)][2]] | add | . > 0'
cmd = f"curl -s {url} | jq -e '{filter}'"
netdata.wait_until_succeeds(cmd, timeout=30)
'';
})

0 comments on commit 694f499

Please sign in to comment.