diff --git a/.agenix_config.nix b/.agenix_config.nix index 69471fe..3452bf2 100644 Binary files a/.agenix_config.nix and b/.agenix_config.nix differ diff --git a/hosts/tatos/services/prometheus-basicauth-password.age b/hosts/tatos/services/prometheus-basicauth-password.age new file mode 100644 index 0000000..ed9da0f Binary files /dev/null and b/hosts/tatos/services/prometheus-basicauth-password.age differ diff --git a/hosts/tatos/services/prometheus.nix b/hosts/tatos/services/prometheus.nix index 260a921..bfd98cc 100644 --- a/hosts/tatos/services/prometheus.nix +++ b/hosts/tatos/services/prometheus.nix @@ -1,17 +1,30 @@ -{ ... }: +{ config, ... }: let nodeExporterPort = 40000; nginxExporterPort = 40001; + postfixExporterPort = 40002; + + basic_auth = { + username = "jan"; + password_file = config.age.secrets.prometheus-basicauth-password.path; + }; in { + age.secrets.prometheus-basicauth-password.file = ./prometheus-basicauth-password.age; + services.prometheus.exporters.node = { enable = true; port = nodeExporterPort; # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix enabledCollectors = [ "systemd" ]; # /nix/store/zgsw0yx18v10xa58psanfabmg95nl2bb-node_exporter-1.8.1/bin/node_exporter --help - extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ]; + extraFlags = [ + "--collector.ethtool" + "--collector.softirqs" + "--collector.tcpstat" + "--collector.wifi" + ]; }; # https://wiki.nixos.org/wiki/Prometheus @@ -36,6 +49,7 @@ in } { job_name = "node_production"; + inherit basic_auth; static_configs = [ { targets = [ @@ -48,6 +62,7 @@ in } { job_name = "nginx_production"; + inherit basic_auth; static_configs = [ { targets = [ @@ -57,6 +72,17 @@ in } ]; } + { + job_name = "sm_smtp"; + # inherit basic_auth; + static_configs = [ + { + targets = [ + "sm-sd1:${toString postfixExporterPort}" + ]; + } + ]; + } ]; }; }