From e11b9a851851bb47109545093e3accdbcab76859 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 13 Jun 2025 21:50:54 +0530 Subject: Add grafana+prometheus + embed into dashboard --- modules/monitoring/prometheus.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 modules/monitoring/prometheus.nix (limited to 'modules/monitoring/prometheus.nix') diff --git a/modules/monitoring/prometheus.nix b/modules/monitoring/prometheus.nix new file mode 100644 index 0000000..5f71c58 --- /dev/null +++ b/modules/monitoring/prometheus.nix @@ -0,0 +1,34 @@ +{ lib, ... }: +let + settings = import ../../settings.nix { inherit lib; }; + ports = settings.network.ports; +in +{ + services.prometheus = { + enable = true; + port = ports.prometheus; + + exporters.node = { + enable = true; + port = ports.prometheusNodeExporter; + enabledCollectors = [ "systemd" ]; + extraFlags = [ + "--collector.ethtool" + "--collector.softirqs" + "--collector.tcpstat" + "--collector.wifi" + ]; + }; + + scrapeConfigs = [ + { + job_name = "system"; + scrape_interval = "10s"; + static_configs = [{ + targets = [ "127.0.0.1:${toString ports.prometheusNodeExporter}" ]; + }]; + } + ]; + }; +} + -- cgit v1.3.1