diff --git a/telegraf.nix b/telegraf.nix index c337619..cc1df2b 100644 --- a/telegraf.nix +++ b/telegraf.nix @@ -1,8 +1,18 @@ { ... }: +let + influxURL = "http://panoptes.john-stream.com:8086"; + organization = "homelab"; + bucket = "docker"; + envFile = ./telegraf.env; +in { + systemd.services.telegraf.serviceConfig = { + SupplementaryGroups = [ "docker" ]; + }; + services.telegraf = { enable = true; - environmentFiles = [ ./telegraf.env ]; + environmentFiles = [ "${envFile}" ]; extraConfig = { agent = { interval = "10s"; @@ -30,10 +40,10 @@ }; outputs = { influxdb_v2 = { - urls = ["http://panoptes.john-stream.com:8086"]; + urls = ["${influxURL}"]; token = "$INFLUX_WRITE_TOKEN"; - organization = "homelab"; - bucket = "docker"; + organization = "${organization}"; + bucket = "${bucket}"; }; }; };