diff options
Diffstat (limited to 'machines/xnet/monitoring/default.nix')
| -rw-r--r-- | machines/xnet/monitoring/default.nix | 76 |
1 files changed, 48 insertions, 28 deletions
diff --git a/machines/xnet/monitoring/default.nix b/machines/xnet/monitoring/default.nix index 87ae724..eed4963 100644 --- a/machines/xnet/monitoring/default.nix +++ b/machines/xnet/monitoring/default.nix @@ -1,38 +1,58 @@ { config, ... }: let - inherit (config.networking) hostName; + inherit (builtins) + map + ; + inherit (config.services.prometheus) exporters; in { - imports = [ ./grafana.nix ./prometheus.nix ]; + imports = [ ./grafana.nix ]; - exporters = { - node = { - enable = true; - enabledCollectors = [ "processes" "systemd" ]; - }; - systemd = { - enable = true; - extraFlags = [ - "--systemd.collector.enable-ip-accounting" - "--systemd.collector.enable-restart-count" - ]; + config = { + services.prometheus = { + enable = config.xnet.monitoring.hostGrafana; + globalConfig.scrape_interval = "1m"; + + exporters = { + node = { + enable = true; + openFirewall = true; + enabledCollectors = [ "processes" "systemd" ]; + }; + + # systemd = { + # enable = true; + # openFirewall = true; + # extraFlags = [ + # "--systemd.collector.enable-ip-accounting" + # "--systemd.collector.enable-restart-count" + # ]; + # }; + + smartctl = { + enable = true; + openFirewall = true; + }; + }; + + scrapeConfigs = + let + hosts = [ "iridium" "radon" ]; + in + [{ + job_name = "node"; + static_configs = [{ + targets = map (h: "${h}:${toString exporters.node.port}") hosts; + }]; + } + { + job_name = "smartctl"; + static_configs = [{ + targets = map (h: "${h}:${toString exporters.smartctl.port}") hosts; + }]; + }]; }; }; - - services.prometheus.scrapeConfigs = [ - { - job_name = "node"; - static_configs = [{ - targets = [ "${hostName}:${toString exporters.node.port}" ]; - }]; - } - { - job_name = "systemd"; - static_configs = [{ - targets = [ "${hostName}:${toString exporters.systemd.port}" ]; - }]; - } - ]; } |
