diff options
Diffstat (limited to 'nixos/modules/services/monitoring/datadog-agent.nix')
-rw-r--r-- | nixos/modules/services/monitoring/datadog-agent.nix | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix index e545e06b3495..8fd3455a238f 100644 --- a/nixos/modules/services/monitoring/datadog-agent.nix +++ b/nixos/modules/services/monitoring/datadog-agent.nix @@ -8,7 +8,6 @@ let ddConf = { dd_url = "https://app.datadoghq.com"; skip_ssl_validation = "no"; - api_key = ""; confd_path = "/etc/datadog-agent/conf.d"; additional_checksd = "/etc/datadog-agent/checks.d"; use_dogstatsd = true; @@ -16,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. @@ -125,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 @@ -206,7 +213,6 @@ in { Group = "datadog"; Restart = "always"; RestartSec = 2; - PrivateTmp = true; }; restartTriggers = [ datadogPkg ] ++ map (etc: etc.source) etcfiles; } attrs; @@ -229,6 +235,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; |