nixos/telegraf: include procps if procstat input is configured

authored by Jörg Thalheim and committed by Jörg Thalheim 501680a6 8ae9c864

+6
+5
nixos/modules/services/monitoring/telegraf.nix
··· 53 53 54 54 ###### implementation 55 55 config = mkIf config.services.telegraf.enable { 56 + services.telegraf.extraConfig = { 57 + inputs = {}; 58 + outputs = {}; 59 + }; 56 60 systemd.services.telegraf = let 57 61 finalConfigFile = if config.services.telegraf.environmentFiles == [] 58 62 then configFile ··· 61 65 description = "Telegraf Agent"; 62 66 wantedBy = [ "multi-user.target" ]; 63 67 after = [ "network-online.target" ]; 68 + path = lib.optional (config.services.telegraf.extraConfig.inputs ? procstat) pkgs.procps; 64 69 serviceConfig = { 65 70 EnvironmentFile = config.services.telegraf.environmentFiles; 66 71 ExecStartPre = lib.optional (config.services.telegraf.environmentFiles != [])
+1
nixos/tests/telegraf.nix
··· 12 12 services.telegraf.extraConfig = { 13 13 agent.interval = "1s"; 14 14 agent.flush_interval = "1s"; 15 + inputs.procstat = {}; 15 16 inputs.exec = { 16 17 commands = [ 17 18 "${pkgs.runtimeShell} -c 'echo $SECRET,tag=a i=42i'"