From 1d21825c7b0f6b922d31cb10b5ad8a1036a8ffe2 Mon Sep 17 00:00:00 2001 From: notohh Date: Mon, 19 Jun 2023 12:47:07 -0400 Subject: [PATCH] modules: init prometheus --- modules/default.nix | 1 + modules/prometheus.nix | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 modules/prometheus.nix 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"]; + }; + }; + }; +}