diff --git a/modules/default.nix b/modules/default.nix index bf24d12..d441150 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -8,5 +8,6 @@ ./openssh.nix ./virtualisation.nix ./sops.nix + ./prometheus.nix ]; } diff --git a/modules/prometheus.nix b/modules/prometheus.nix new file mode 100644 index 0000000..928d912 --- /dev/null +++ b/modules/prometheus.nix @@ -0,0 +1,24 @@ +_: { + networking.firewall.allowedTCPPorts = [9090]; + services.prometheus = { + enable = true; + scrapeConfigs = [ + { + job_name = "prometheus"; + scrape_interval = "30s"; + static_configs = [{targets = ["localhost:9090"];}]; + } + { + job_name = "node"; + scrape_interval = "30s"; + static_configs = [{targets = ["localhost:9100"];}]; + } + ]; + exporters = { + node = { + enable = true; + enabledCollectors = ["systemd" "cpu"]; + }; + }; + }; +}