summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2018-09-12 17:46:31 +0100
committerDomen Kožar <domen@enlambda.com>2018-09-13 09:11:06 +0100
commitbef541c5699cb7c6323dbb8756382dc12731af6a (patch)
tree5e56fa675fa6e441f7646f526800ffc695b5d45c /nixos
parent049b3a6cc2fb271b0ad9f611be02f4728f6eeeca (diff)
downloadnixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar.gz
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar.bz2
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar.lz
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar.xz
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.tar.zst
nixpkgs-bef541c5699cb7c6323dbb8756382dc12731af6a.zip
datadog: add live process monitoring
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/datadog-agent.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix
index 57815f211d4..35c08f5e7e3 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;