From 336c7d3832a8c8986c44c7947173802b1bc84179 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 12 Jan 2024 19:13:46 +0300 Subject: [PATCH] Add scrape configs --- hosts/cube/mail.nix | 14 ++++++++++++++ hosts/cube/nginx.nix | 12 ++++++++++++ hosts/cube/prometheus.nix | 9 +++++++++ 3 files changed, 35 insertions(+) diff --git a/hosts/cube/mail.nix b/hosts/cube/mail.nix index 7af04eb..ae61ff9 100644 --- a/hosts/cube/mail.nix +++ b/hosts/cube/mail.nix @@ -28,6 +28,20 @@ in serverSystemConfiguration { }; }; + services.prometheus.scrapeConfigs = [{ + job_name = "mail"; + + static_configs = [{ + labels = [ "mail" ]; + targets = [ + "[::]:${toString config.services.prometheus.exporters.dmarc.port}" + "[::]:${toString config.services.prometheus.exporters.dovecot.port}" + "[::]:${toString config.services.prometheus.exporters.postfix.port}" + "[::]:${toString config.services.prometheus.exporters.rspamd.port}" + ]; + }]; + }]; + mailserver = enabled { inherit fqdn; diff --git a/hosts/cube/nginx.nix b/hosts/cube/nginx.nix index 8b81366..8f0af6f 100644 --- a/hosts/cube/nginx.nix +++ b/hosts/cube/nginx.nix @@ -13,6 +13,18 @@ serverSystemConfiguration { }; }; + services.prometheus.scrapeConfigs = [{ + job_name = "nginx"; + + static_configs = [{ + labels = [ "nginx" ]; + targets = [ + "[::]:${toString config.services.prometheus.exporters.nginxlog.port}" + "[::]:${toString config.services.prometheus.exporters.nginx.port}" + ]; + }]; + }]; + services.nginx = enabled { statusPage = true; diff --git a/hosts/cube/prometheus.nix b/hosts/cube/prometheus.nix index 0ca200d..22f750a 100644 --- a/hosts/cube/prometheus.nix +++ b/hosts/cube/prometheus.nix @@ -8,5 +8,14 @@ serverSystemConfiguration { enabledCollectors = [ "systemd" ]; port = 9001; }; + + scrapeConfigs = [{ + job_name = "node"; + + static_configs = [{ + labels = [ "node" ]; + targets = [ "[::]:${toString config.services.prometheus.exporters.node.port}" ]; + }]; + }]; }; }