dd-agent: Add default config files of dd-agent and auto_conf dir
to /etc/dd-agent/conf.d by default, and make sure /etc/dd-agent/conf.d is used. Before NixOS 17.03, we were using dd-agent 5.5.X which used configuration from /etc/dd-agent/conf.d In NixOS 17.03 the default conf.d location is first used relative, meaning that $out/agent/conf.d was used without NixOS overrides. This change implements similar functionality as PR #25288, without breaking backwards compatibility. (cherry picked from commit 77c85b0ecbc1070d7adff31b339bede92e4193fa)
This commit is contained in:
parent
f277137522
commit
a9f054c834
@ -328,7 +328,7 @@
|
|||||||
./services/monitoring/cadvisor.nix
|
./services/monitoring/cadvisor.nix
|
||||||
./services/monitoring/collectd.nix
|
./services/monitoring/collectd.nix
|
||||||
./services/monitoring/das_watchdog.nix
|
./services/monitoring/das_watchdog.nix
|
||||||
./services/monitoring/dd-agent.nix
|
./services/monitoring/dd-agent/dd-agent.nix
|
||||||
./services/monitoring/grafana.nix
|
./services/monitoring/grafana.nix
|
||||||
./services/monitoring/graphite.nix
|
./services/monitoring/graphite.nix
|
||||||
./services/monitoring/hdaps.nix
|
./services/monitoring/hdaps.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"
|
||||||
|
]
|
@ -75,7 +75,12 @@ let
|
|||||||
jmxConfig = pkgs.writeText "jmx.yaml" cfg.jmxConfig;
|
jmxConfig = pkgs.writeText "jmx.yaml" cfg.jmxConfig;
|
||||||
|
|
||||||
etcfiles =
|
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";
|
target = "dd-agent/datadog.conf";
|
||||||
}
|
}
|
||||||
{ source = diskConfig;
|
{ source = diskConfig;
|
9
nixos/modules/services/monitoring/dd-agent/update-dd-agent-defaults
Executable file
9
nixos/modules/services/monitoring/dd-agent/update-dd-agent-defaults
Executable file
@ -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
|
@ -64,6 +64,9 @@ in stdenv.mkDerivation rec {
|
|||||||
ln -s $out/agent/dogstatsd.py $out/bin/dogstatsd
|
ln -s $out/agent/dogstatsd.py $out/bin/dogstatsd
|
||||||
ln -s $out/agent/ddagent.py $out/bin/dd-forwarder
|
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 <<EOF
|
cat > $out/bin/dd-jmxfetch <<EOF
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
exec ${python}/bin/python $out/agent/jmxfetch.py $@
|
exec ${python}/bin/python $out/agent/jmxfetch.py $@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user