From a905bff8b0b1bcf7557074ece7fd17b379cdda75 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:20:23 -0600 Subject: [PATCH] converted to variables --- telegraf.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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}"; }; }; };