From 3498b31257e07876d5442cb15ed35ed822aea4fa Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 26 Dec 2025 11:24:44 +0100 Subject: refactor: define prometheusScrapeConfigs in main modules --- nixos/hosts/ev/default.nix | 8 ++++++++ nixos/hosts/ev/exporters.nix | 9 --------- nixos/hosts/tente/default.nix | 14 ++++++++++++++ nixos/hosts/tente/exporters.nix | 15 --------------- 4 files changed, 22 insertions(+), 24 deletions(-) (limited to 'nixos/hosts') diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix index c5abe4d..5d6de93 100644 --- a/nixos/hosts/ev/default.nix +++ b/nixos/hosts/ev/default.nix @@ -164,6 +164,14 @@ in lokiPort = ports.grafanaLoki; prometheusPort = ports.prometheus; prometheusNodeExporterPort = ports.prometheusNodeExporter; + prometheusScrapeConfigs = [ + { + job_name = "sql"; + static_configs = [{ + targets = ["localhost:${toString ports.prometheusSqlExporter}"]; + }]; + } + ]; }; # Backups diff --git a/nixos/hosts/ev/exporters.nix b/nixos/hosts/ev/exporters.nix index 1c03c35..097e3e5 100644 --- a/nixos/hosts/ev/exporters.nix +++ b/nixos/hosts/ev/exporters.nix @@ -29,14 +29,5 @@ in collectors = helpers.collectors; }; }; - - monitoring.prometheusScrapeConfigs = [ - { - job_name = "sql"; - static_configs = [{ - targets = [ "localhost:${toString cfg.sqlExporterPort}" ]; - }]; - } - ]; }; } diff --git a/nixos/hosts/tente/default.nix b/nixos/hosts/tente/default.nix index cc97830..749f468 100644 --- a/nixos/hosts/tente/default.nix +++ b/nixos/hosts/tente/default.nix @@ -249,6 +249,20 @@ in ]; prometheusPort = ports.prometheus; prometheusNodeExporterPort = ports.prometheusNodeExporter; + prometheusScrapeConfigs = [ + { + job_name = "sql"; + static_configs = [{ + targets = ["localhost:${toString ports.prometheusSqlExporter}"]; + }]; + } + { + job_name = "storagebox"; + static_configs = [{ + targets = ["localhost:${toString ports.prometheusStorageboxExporter}"]; + }]; + } + ]; }; # Backups diff --git a/nixos/hosts/tente/exporters.nix b/nixos/hosts/tente/exporters.nix index eb46015..3a587e0 100644 --- a/nixos/hosts/tente/exporters.nix +++ b/nixos/hosts/tente/exporters.nix @@ -41,20 +41,5 @@ in port = cfg.storageboxExporterPort; hetznerTokenFile = config.age.secrets.hetzner-token.path; }; - - monitoring.prometheusScrapeConfigs = [ - { - job_name = "sql"; - static_configs = [{ - targets = [ "localhost:${toString cfg.sqlExporterPort}" ]; - }]; - } - { - job_name = "storagebox"; - static_configs = [{ - targets = [ "localhost:${toString cfg.storageboxExporterPort}" ]; - }]; - } - ]; }; } -- cgit v1.3.1