dd-agent: cleanup, add dogstatsd systemd service
This commit is contained in:
parent
a20630476f
commit
36f2ec84a9
@ -5,7 +5,7 @@ with pkgs.lib;
|
|||||||
let
|
let
|
||||||
cfg = config.services.dd-agent;
|
cfg = config.services.dd-agent;
|
||||||
|
|
||||||
datadog-conf = pkgs.runCommand "datadog.conf" {} ''
|
datadog_conf = pkgs.runCommand "datadog.conf" {} ''
|
||||||
sed -e 's|^api_key:|api_key: ${cfg.api_key}|' ${optionalString (cfg.hostname != null)
|
sed -e 's|^api_key:|api_key: ${cfg.api_key}|' ${optionalString (cfg.hostname != null)
|
||||||
"-e 's|^#hostname: mymachine.mydomain|hostname: ${cfg.hostname}|'"
|
"-e 's|^#hostname: mymachine.mydomain|hostname: ${cfg.hostname}|'"
|
||||||
} ${pkgs.dd-agent}/etc/dd-agent/datadog.conf.example > $out
|
} ${pkgs.dd-agent}/etc/dd-agent/datadog.conf.example > $out
|
||||||
@ -41,8 +41,8 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.etc = [ { source = datadog-conf; target = "dd-agent/datadog.conf"; } ];
|
environment.etc = [ { source = datadog_conf; target = "dd-agent/datadog.conf"; } ];
|
||||||
environment.systemPackages = [ pkgs."dd-agent" ];
|
environment.systemPackages = [ pkgs."dd-agent" pkgs.sysstat pkgs.procps ];
|
||||||
|
|
||||||
users.extraUsers."dd-agent" = {
|
users.extraUsers."dd-agent" = {
|
||||||
description = "Datadog Agent User";
|
description = "Datadog Agent User";
|
||||||
@ -55,14 +55,28 @@ in {
|
|||||||
|
|
||||||
systemd.services.dd-agent = {
|
systemd.services.dd-agent = {
|
||||||
description = "Datadog agent monitor";
|
description = "Datadog agent monitor";
|
||||||
path = [ pkgs."dd-agent" ];
|
path = [ pkgs."dd-agent" pkgs.python pkgs.sysstat pkgs.procps];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.dd-agent}/bin/dd-agent foreground";
|
ExecStart = "${pkgs.dd-agent}/bin/dd-agent foreground";
|
||||||
User = "dd-agent";
|
User = "dd-agent";
|
||||||
Group = "dd-agent";
|
Group = "dd-agent";
|
||||||
};
|
};
|
||||||
restartTriggers = [ pkgs.dd-agent ];
|
restartTriggers = [ pkgs.dd-agent datadog_conf ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.dogstatsd = {
|
||||||
|
description = "Datadog statsd";
|
||||||
|
path = [ pkgs."dd-agent" pkgs.python ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.dd-agent}/bin/dogstatsd start";
|
||||||
|
User = "dd-agent";
|
||||||
|
Group = "dd-agent";
|
||||||
|
Type = "forking";
|
||||||
|
PIDFile = "/tmp/dogstatsd.pid";
|
||||||
|
};
|
||||||
|
restartTriggers = [ pkgs.dd-agent datadog_conf ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user