From bef541c5699cb7c6323dbb8756382dc12731af6a Mon Sep 17 00:00:00 2001 From: Domen Kožar Date: Wed, 12 Sep 2018 17:46:31 +0100 Subject: datadog: add live process monitoring --- nixos/modules/services/monitoring/datadog-agent.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'nixos/modules/services/monitoring/datadog-agent.nix') diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix index 57815f211d46..35c08f5e7e30 100644 --- a/nixos/modules/services/monitoring/datadog-agent.nix +++ b/nixos/modules/services/monitoring/datadog-agent.nix @@ -15,6 +15,7 @@ let // optionalAttrs (cfg.logLevel != null) { log_level = cfg.logLevel; } // optionalAttrs (cfg.hostname != null) { inherit (cfg) hostname; } // optionalAttrs (cfg.tags != null ) { tags = concatStringsSep ", " cfg.tags; } + // optionalAttrs (cfg.enableLiveProcessCollection) { process_config = { enabled = "true"; }; } // cfg.extraConfig; # Generate Datadog configuration files for each configured checks. @@ -124,6 +125,13 @@ in { ''; }; + enableLiveProcessCollection = mkOption { + description = '' + Whether to enable the live process collection agent. + ''; + default = false; + type = types.bool; + }; checks = mkOption { description = '' Configuration for all Datadog checks. Keys of this attribute @@ -228,6 +236,15 @@ in { path = [ datadogPkg pkgs.python pkgs.sysstat pkgs.procps pkgs.jdk ]; serviceConfig.ExecStart = "${datadogPkg}/bin/dd-jmxfetch"; }); + + datadog-process-agent = lib.mkIf cfg.enableLiveProcessCollection (makeService { + description = "Datadog Live Process Agent"; + path = [ ]; + script = '' + export DD_API_KEY=$(head -n 1 ${cfg.apiKeyFile}) + ${pkgs.datadog-process-agent}/bin/agent --config /etc/datadog-agent/datadog.yaml + ''; + }); }; environment.etc = etcfiles; -- cgit 1.4.1