mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 21:21:06 +00:00
dd-agent: support jmx, needs a separate daemon nowadays.
This commit is contained in:
parent
b062b52729
commit
1425a1f964
|
@ -72,6 +72,7 @@ let
|
|||
postgresqlConfig = pkgs.writeText "postgres.yaml" cfg.postgresqlConfig;
|
||||
nginxConfig = pkgs.writeText "nginx.yaml" cfg.nginxConfig;
|
||||
mongoConfig = pkgs.writeText "mongo.yaml" cfg.mongoConfig;
|
||||
jmxConfig = pkgs.writeText "jmx.yaml" cfg.jmxConfig;
|
||||
|
||||
etcfiles =
|
||||
[ { source = ddConf;
|
||||
|
@ -94,6 +95,10 @@ let
|
|||
(optional (cfg.mongoConfig != null)
|
||||
{ source = mongoConfig;
|
||||
target = "dd-agent/conf.d/mongo.yaml";
|
||||
}) ++
|
||||
(optional (cfg.jmxConfig != null)
|
||||
{ source = jmxConfig;
|
||||
target = "dd-agent/conf.d/jmx.yaml";
|
||||
});
|
||||
|
||||
in {
|
||||
|
@ -141,6 +146,13 @@ in {
|
|||
default = null;
|
||||
type = types.uniq (types.nullOr types.string);
|
||||
};
|
||||
|
||||
jmxConfig = mkOption {
|
||||
description = "JMX integration configuration";
|
||||
default = null;
|
||||
type = types.uniq (types.nullOr types.string);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -167,7 +179,7 @@ in {
|
|||
Restart = "always";
|
||||
RestartSec = 2;
|
||||
};
|
||||
restartTriggers = [ pkgs.dd-agent ddConf diskConfig networkConfig postgresqlConfig nginxConfig mongoConfig ];
|
||||
restartTriggers = [ pkgs.dd-agent ddConf diskConfig networkConfig postgresqlConfig nginxConfig mongoConfig jmxConfig ];
|
||||
};
|
||||
|
||||
systemd.services.dogstatsd = {
|
||||
|
@ -183,7 +195,21 @@ in {
|
|||
Restart = "always";
|
||||
RestartSec = 2;
|
||||
};
|
||||
restartTriggers = [ pkgs.dd-agent ddConf diskConfig networkConfig postgresqlConfig nginxConfig mongoConfig ];
|
||||
restartTriggers = [ pkgs.dd-agent ddConf diskConfig networkConfig postgresqlConfig nginxConfig mongoConfig jmxConfig ];
|
||||
};
|
||||
|
||||
systemd.services.dd-jmxfetch = lib.mkIf (cfg.jmxConfig != null) {
|
||||
description = "Datadog JMX Fetcher";
|
||||
path = [ pkgs."dd-agent" pkgs.python pkgs.sysstat pkgs.procps pkgs.jdk ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.dd-agent}/bin/dd-jmxfetch";
|
||||
User = "datadog";
|
||||
Group = "datadog";
|
||||
Restart = "always";
|
||||
RestartSec = 2;
|
||||
};
|
||||
restartTriggers = [ pkgs.dd-agent ddConf diskConfig networkConfig postgresqlConfig nginxConfig mongoConfig jmxConfig ];
|
||||
};
|
||||
|
||||
environment.etc = etcfiles;
|
||||
|
|
|
@ -36,12 +36,20 @@ stdenv.mkDerivation rec {
|
|||
ln -s $out/agent/dogstatsd.py $out/bin/dogstatsd
|
||||
ln -s $out/agent/ddagent.py $out/bin/dd-forwarder
|
||||
|
||||
cat > $out/bin/dd-jmxfetch <<EOF
|
||||
#!/usr/bin/env bash
|
||||
exec ${python}/bin/python $out/agent/jmxfetch.py $@
|
||||
EOF
|
||||
chmod a+x $out/bin/dd-jmxfetch
|
||||
|
||||
wrapProgram $out/bin/dd-forwarder \
|
||||
--prefix PYTHONPATH : $PYTHONPATH
|
||||
wrapProgram $out/bin/dd-agent \
|
||||
--prefix PYTHONPATH : $PYTHONPATH
|
||||
wrapProgram $out/bin/dogstatsd \
|
||||
--prefix PYTHONPATH : $PYTHONPATH
|
||||
wrapProgram $out/bin/dd-jmxfetch \
|
||||
--prefix PYTHONPATH : $PYTHONPATH
|
||||
|
||||
patchShebangs $out
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue