2017-10-17 19:51:41 -04:00
|
|
|
# This test runs netdata and checks for data via apps.plugin
|
|
|
|
|
2019-11-24 22:26:32 +02:00
|
|
|
import ./make-test-python.nix (
|
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2017-10-17 19:51:41 -04:00
|
|
|
name = "netdata";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2023-03-17 17:27:01 +01:00
|
|
|
maintainers = [
|
|
|
|
cransom
|
|
|
|
raitobezarius
|
|
|
|
];
|
2017-10-17 19:51:41 -04:00
|
|
|
};
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2017-10-17 19:51:41 -04:00
|
|
|
nodes = {
|
|
|
|
netdata =
|
2018-07-20 20:56:59 +00:00
|
|
|
{ pkgs, ... }:
|
2017-10-17 19:51:41 -04:00
|
|
|
{
|
2023-08-05 17:52:52 +08:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
curl
|
|
|
|
jq
|
|
|
|
netdata
|
|
|
|
];
|
2024-03-24 16:59:24 +01:00
|
|
|
services.netdata = {
|
|
|
|
enable = true;
|
2025-03-16 16:08:08 +01:00
|
|
|
package = pkgs.netdataCloud;
|
2024-03-24 16:59:24 +01:00
|
|
|
python.recommendedPythonPackages = true;
|
2024-11-15 18:02:26 -05:00
|
|
|
|
|
|
|
configDir."apps_groups.conf" = pkgs.writeText "apps_groups.conf" ''
|
|
|
|
netdata_test: netdata
|
|
|
|
'';
|
2024-03-24 16:59:24 +01:00
|
|
|
};
|
2017-10-17 19:51:41 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2025-05-06 22:13:43 +02:00
|
|
|
start_all()
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2025-05-06 22:13:43 +02:00
|
|
|
netdata.wait_for_unit("netdata.service")
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2025-05-06 22:13:43 +02:00
|
|
|
# wait for the service to listen before sending a request
|
|
|
|
netdata.wait_for_open_port(19999)
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2018-08-05 00:05:48 +02:00
|
|
|
# check if the netdata main page loads.
|
2025-03-16 16:08:08 +01:00
|
|
|
netdata.succeed("curl --fail http://127.0.0.1:19999")
|
2019-12-08 14:06:25 +03:00
|
|
|
netdata.succeed("sleep 4")
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2025-03-16 16:08:08 +01:00
|
|
|
# check if netdata api shows correct os
|
|
|
|
url = "http://127.0.0.1:19999/api/v3/info"
|
|
|
|
filter = '.agents[0].application.os.os | . == "NixOS"'
|
2019-11-24 22:26:32 +02:00
|
|
|
cmd = f"curl -s {url} | jq -e '{filter}'"
|
|
|
|
netdata.wait_until_succeeds(cmd)
|
2025-04-01 20:10:43 +02:00
|
|
|
|
2023-08-05 17:52:52 +08:00
|
|
|
# check if the control socket is available
|
|
|
|
netdata.succeed("sudo netdatacli ping")
|
2017-10-17 19:51:41 -04:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|