diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 7e523ac483cd..9e1166af0946 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -328,7 +328,7 @@ ./services/monitoring/cadvisor.nix ./services/monitoring/collectd.nix ./services/monitoring/das_watchdog.nix - ./services/monitoring/dd-agent.nix + ./services/monitoring/dd-agent/dd-agent.nix ./services/monitoring/grafana.nix ./services/monitoring/graphite.nix ./services/monitoring/hdaps.nix diff --git a/nixos/modules/services/monitoring/dd-agent/dd-agent-defaults.nix b/nixos/modules/services/monitoring/dd-agent/dd-agent-defaults.nix new file mode 100644 index 000000000000..045128197421 --- /dev/null +++ b/nixos/modules/services/monitoring/dd-agent/dd-agent-defaults.nix @@ -0,0 +1,8 @@ +# Generated using update-dd-agent-default, please re-run after updating dd-agent. DO NOT EDIT MANUALLY. +[ + "auto_conf" + "agent_metrics.yaml.default" + "disk.yaml.default" + "network.yaml.default" + "ntp.yaml.default" +] diff --git a/nixos/modules/services/monitoring/dd-agent.nix b/nixos/modules/services/monitoring/dd-agent/dd-agent.nix similarity index 96% rename from nixos/modules/services/monitoring/dd-agent.nix rename to nixos/modules/services/monitoring/dd-agent/dd-agent.nix index a98b0f2f0f85..2fb1b9020bff 100644 --- a/nixos/modules/services/monitoring/dd-agent.nix +++ b/nixos/modules/services/monitoring/dd-agent/dd-agent.nix @@ -75,7 +75,12 @@ let jmxConfig = pkgs.writeText "jmx.yaml" cfg.jmxConfig; etcfiles = - [ { source = ddConf; + let + defaultConfd = import ./dd-agent-defaults.nix; + in (map (f: { source = "${pkgs.dd-agent}/agent/conf.d-system/${f}"; + target = "dd-agent/conf.d/${f}"; + }) defaultConfd) ++ [ + { source = ddConf; target = "dd-agent/datadog.conf"; } { source = diskConfig; diff --git a/nixos/modules/services/monitoring/dd-agent/update-dd-agent-defaults b/nixos/modules/services/monitoring/dd-agent/update-dd-agent-defaults new file mode 100755 index 000000000000..76724173171a --- /dev/null +++ b/nixos/modules/services/monitoring/dd-agent/update-dd-agent-defaults @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +dd=$(nix-build --no-out-link -A dd-agent ../../../..) +echo '# Generated using update-dd-agent-default, please re-run after updating dd-agent. DO NOT EDIT MANUALLY.' > dd-agent-defaults.nix +echo '[' >> dd-agent-defaults.nix +echo ' "auto_conf"' >> dd-agent-defaults.nix +for f in $(find $dd/agent/conf.d-system -maxdepth 1 -type f | grep -v '\.example' | sort); do + echo " \"$(basename $f)\"" >> dd-agent-defaults.nix +done +echo ']' >> dd-agent-defaults.nix diff --git a/pkgs/tools/networking/dd-agent/default.nix b/pkgs/tools/networking/dd-agent/default.nix index 10b7b47b3f4c..e9a70b17130c 100644 --- a/pkgs/tools/networking/dd-agent/default.nix +++ b/pkgs/tools/networking/dd-agent/default.nix @@ -64,6 +64,9 @@ in stdenv.mkDerivation rec { ln -s $out/agent/dogstatsd.py $out/bin/dogstatsd ln -s $out/agent/ddagent.py $out/bin/dd-forwarder + # Move out default conf.d so that /etc/dd-agent/conf.d is used + mv $out/agent/conf.d $out/agent/conf.d-system + cat > $out/bin/dd-jmxfetch <