diff options
| author | Max Audron <audron@cocaine.farm> | 2025-08-01 00:47:20 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-08-01 00:47:20 +0200 |
| commit | 4e6b076f1e629670229e6e3c53e43f818f4f2d62 (patch) | |
| tree | f960e0cf45d2f00d5128d10db8ef73164eb11dbd /modules/monitoring | |
| parent | update garage to 2.0 (diff) | |
more monitoring & scrape config shortcuts
Diffstat (limited to 'modules/monitoring')
| -rw-r--r-- | modules/monitoring/default.nix | 70 | ||||
| -rw-r--r-- | modules/monitoring/node-exporter.nix | 12 |
2 files changed, 17 insertions, 65 deletions
diff --git a/modules/monitoring/default.nix b/modules/monitoring/default.nix index 05ca338..afcffa5 100644 --- a/modules/monitoring/default.nix +++ b/modules/monitoring/default.nix @@ -1,7 +1,9 @@ { self, config, lib, pkgs, ... }: with self.lib.nginx; -{ +with self.lib.mon; +let exp = config.services.prometheus.exporters; +in { services.prometheus = { enable = true; enableReload = true; @@ -10,70 +12,32 @@ with self.lib.nginx; listenAddress = "10.10.0.1"; webExternalUrl = "https://prometheus.vapor.systems"; - exporters = { - postgres = { - enable = true; - }; - }; - globalConfig = { scrape_interval = "10s"; }; scrapeConfigs = [ - { - job_name = "node"; - static_configs = [ - { targets = [ "ettves:${toString config.services.prometheus.exporters.node.port}" ]; } - { targets = [ "phaenn:${toString config.services.prometheus.exporters.node.port}" ]; } - ]; - } - { - job_name = "zfs"; - static_configs = [ - { targets = [ "ettves:${toString config.services.prometheus.exporters.zfs.port}" ]; } - { targets = [ "phaenn:${toString config.services.prometheus.exporters.zfs.port}" ]; } - ]; - } - { - job_name = "smartctl"; - static_configs = [ - { targets = [ "ettves:${toString config.services.prometheus.exporters.smartctl.port}" ]; } - { targets = [ "phaenn:${toString config.services.prometheus.exporters.smartctl.port}" ]; } - ]; - } - { - job_name = "postgres"; - static_configs = [ - { targets = [ "ettves:${toString config.services.prometheus.exporters.postgres.port}" ]; } - ]; - } - { - job_name = "nginx"; - static_configs = [ - { targets = [ "ettves:${toString config.services.prometheus.exporters.nginx.port}" ]; } - { targets = [ "phaenn:${toString config.services.prometheus.exporters.nginx.port}" ]; } - ]; - } - { - job_name = "quassel"; - static_configs = [ - { targets = [ "localhost:${toString config.services.quassel.settings.metrics.port}" ]; } - ]; - } + (mkScrapeConfig "node" [ "ettves" "phaenn" "fra01" "nyc01" "sin01" ] exp.node.port) + (mkScrapeConfig "zfs" [ "ettves" "phaenn" ] exp.zfs.port) + (mkScrapeConfig "smartctl" [ "ettves" "phaenn" ] exp.smartctl.port) + (mkScrapeConfig "nginx" [ "ettves" "phaenn" "fra01" "nyc01" "sin01" ] exp.nginx.port) + + (mkScrapeConfig "postgres" [ "ettves" ] exp.postgres.port) + (mkScrapeConfig "quassel" [ "localhost" ] config.services.quassel.settings.metrics.port) + { job_name = "authentik"; static_configs = [ - { targets = [ "ettves:9300" ]; } - { targets = [ "ettves:9303" ]; } - { targets = [ "ettves:9304" ]; } + { targets = [ "ettves:9300" "ettves:9303" "ettves:9304" ]; } ]; + relabel_configs = relabelConfig; } + + (mkScrapeConfig "garage" [ "fra01" "nyc01" "sin01" ] 3903) + (mkScrapeConfig "pdns" [ "ettves" "fra01" "nyc01" "sin01" ] 8081) ]; }; - services.nginx.statusPage = true; - services.udev.extraRules = '' SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk" ''; @@ -87,7 +51,7 @@ with self.lib.nginx; services.nginx = { enable = true; virtualHosts = { - "prometheus.vapor.systems" = (proxyDomain "vapor.systems" "http://10.10.0.1:9090/"); + "prometheus.vapor.systems" = (proxyDomainAuth "vapor.systems" "http://10.10.0.1:9090/"); }; }; } diff --git a/modules/monitoring/node-exporter.nix b/modules/monitoring/node-exporter.nix index 1b7481d..7508953 100644 --- a/modules/monitoring/node-exporter.nix +++ b/modules/monitoring/node-exporter.nix @@ -9,23 +9,11 @@ with self.lib.nginx; enabledCollectors = [ "systemd" ]; }; - zfs = { - enable = true; - }; - nginx = { enable = true; }; - - smartctl = { - enable = true; - }; }; }; services.nginx.statusPage = true; - - services.udev.extraRules = '' - SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk" - ''; } |
