2019-09-20 19:00:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.do-agent;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.do-agent = {
|
|
|
|
enable = mkEnableOption "do-agent, the DigitalOcean droplet metrics agent";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.do-agent ];
|
|
|
|
|
|
|
|
systemd.services.do-agent = {
|
|
|
|
description = "DigitalOcean Droplet Metrics Agent";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2019-10-02 18:44:33 +01:00
|
|
|
after = [ "network-online.target" ];
|
|
|
|
wants = [ "network-online.target" ];
|
2019-09-20 19:00:48 +01:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.do-agent}/bin/do-agent --syslog";
|
|
|
|
Restart = "always";
|
|
|
|
OOMScoreAdjust = -900;
|
|
|
|
SyslogIdentifier = "DigitalOceanAgent";
|
|
|
|
PrivateTmp = "yes";
|
|
|
|
ProtectSystem = "full";
|
|
|
|
ProtectHome = "yes";
|
|
|
|
NoNewPrivileges = "yes";
|
2019-10-02 17:30:41 +01:00
|
|
|
DynamicUser = "yes";
|
2019-09-20 19:00:48 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|