dd-agent: Add support for MongoDB monitoring

This commit is contained in:
Sander van der Burg 2015-08-03 09:09:52 +00:00
parent fa7860f84d
commit dc2a6e3d3d
2 changed files with 16 additions and 4 deletions

View File

@ -53,6 +53,7 @@ let
postgresqlConfig = pkgs.writeText "postgres.yaml" cfg.postgresqlConfig; postgresqlConfig = pkgs.writeText "postgres.yaml" cfg.postgresqlConfig;
nginxConfig = pkgs.writeText "nginx.yaml" cfg.nginxConfig; nginxConfig = pkgs.writeText "nginx.yaml" cfg.nginxConfig;
mongoConfig = pkgs.writeText "mongo.yaml" cfg.mongoConfig;
etcfiles = etcfiles =
[ { source = ddConf; [ { source = ddConf;
@ -65,6 +66,10 @@ let
(optional (cfg.nginxConfig != null) (optional (cfg.nginxConfig != null)
{ source = nginxConfig; { source = nginxConfig;
target = "dd-agent/conf.d/nginx.yaml"; target = "dd-agent/conf.d/nginx.yaml";
}) ++
(optional (cfg.mongoConfig != null)
{ source = mongoConfig;
target = "dd-agent/conf.d/mongo.yaml";
}); });
in { in {
@ -106,6 +111,12 @@ in {
default = null; default = null;
type = types.uniq (types.nullOr types.string); type = types.uniq (types.nullOr types.string);
}; };
mongoConfig = mkOption {
description = "MongoDB integration configuration";
default = null;
type = types.uniq (types.nullOr types.string);
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -123,7 +134,7 @@ in {
systemd.services.dd-agent = { systemd.services.dd-agent = {
description = "Datadog agent monitor"; description = "Datadog agent monitor";
path = [ pkgs."dd-agent" pkgs.python pkgs.sysstat pkgs.procps]; 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";
@ -132,7 +143,7 @@ in {
Restart = "always"; Restart = "always";
RestartSec = 2; RestartSec = 2;
}; };
restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ]; restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig mongoConfig ];
}; };
systemd.services.dogstatsd = { systemd.services.dogstatsd = {
@ -149,7 +160,7 @@ in {
RestartSec = 2; RestartSec = 2;
}; };
environment.SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt"; environment.SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ]; restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig mongoConfig ];
}; };
environment.etc = etcfiles; environment.etc = etcfiles;

View File

@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
pythonPackages.simplejson pythonPackages.simplejson
pythonPackages.pyyaml pythonPackages.pyyaml
pythonPackages.requests pythonPackages.requests
pythonPackages.pymongo
]; ];
propagatedBuildInputs = [ python tornado ]; propagatedBuildInputs = [ python tornado ];