mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/netdata: copy apps_groups.conf instead of symlink
Currently, it is not possible to configure `apps.plugin` via NixOS
option `services.netdata.configDir."apps_groups.conf"`. This is because
`apps.plugin` explicitly does not follow symbolic links when reading its
configuration from apps_groups.conf[^ref].
This change will copy that file instead of symlinking to address this.
Fixes #255161
[^ref]: 3849e70f93/src/collectors/apps.plugin/apps_plugin.c (L679)
This commit is contained in:
parent
5e2c2958b3
commit
a61e43e18e
2 changed files with 14 additions and 2 deletions
|
@ -27,7 +27,7 @@ let
|
||||||
mkdir $out
|
mkdir $out
|
||||||
${concatStringsSep "\n" (mapAttrsToList (path: file: ''
|
${concatStringsSep "\n" (mapAttrsToList (path: file: ''
|
||||||
mkdir -p "$out/$(dirname ${path})"
|
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)}
|
'') cfg.configDir)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@ import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
services.netdata = {
|
services.netdata = {
|
||||||
enable = true;
|
enable = true;
|
||||||
python.recommendedPythonPackages = true;
|
python.recommendedPythonPackages = true;
|
||||||
|
|
||||||
|
configDir."apps_groups.conf" = pkgs.writeText "apps_groups.conf" ''
|
||||||
|
netdata_test: netdata
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -33,12 +37,20 @@ import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
# check if netdata can read disk ops for root owned processes.
|
# check if netdata can read disk ops for root owned processes.
|
||||||
# if > 0, successful. verifies both netdata working and
|
# if > 0, successful. verifies both netdata working and
|
||||||
# apps.plugin has elevated capabilities.
|
# 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'
|
filter = '[.data[range(10)][2]] | add | . < 0'
|
||||||
cmd = f"curl -s {url} | jq -e '{filter}'"
|
cmd = f"curl -s {url} | jq -e '{filter}'"
|
||||||
netdata.wait_until_succeeds(cmd)
|
netdata.wait_until_succeeds(cmd)
|
||||||
|
|
||||||
# check if the control socket is available
|
# check if the control socket is available
|
||||||
netdata.succeed("sudo netdatacli ping")
|
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)
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue