From 60ff89b7ccdf29051521104fe1f1095c896c1e59 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 5 Apr 2023 17:00:01 +0200 Subject: [PATCH] Add monitoring services --- configuration.nix | 1 + monitoring.nix | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 monitoring.nix diff --git a/configuration.nix b/configuration.nix index e00c8df..e1b9ce5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -7,6 +7,7 @@ ./boot.nix ./fs.nix ./gitlab-runner.nix + ./monitoring.nix ./net.nix ./overlays.nix ./slurm.nix diff --git a/monitoring.nix b/monitoring.nix new file mode 100644 index 0000000..67a8615 --- /dev/null +++ b/monitoring.nix @@ -0,0 +1,50 @@ +{ config, lib, ... }: + +{ + services.grafana = { + enable = true; + settings.server = { + http_port = 2342; + http_addr = "127.0.0.1"; + }; + }; + + services.prometheus = { + enable = true; + port = 9001; + }; + + systemd.services.prometheus-ipmi-exporter.serviceConfig.DynamicUser = lib.mkForce false; + systemd.services.prometheus-ipmi-exporter.serviceConfig.PrivateDevices = lib.mkForce false; + + virtualisation.docker.daemon.settings = { + metrics-addr = "127.0.0.1:9323"; + }; + + services.prometheus = { + + exporters = { + ipmi.enable = true; + ipmi.group = "root"; + ipmi.user = "root"; + node = { + enable = true; + enabledCollectors = [ "systemd" ]; + port = 9002; + }; + }; + + scrapeConfigs = [ + { + job_name = "xeon07"; + static_configs = [{ + targets = [ + "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" + "127.0.0.1:${toString config.services.prometheus.exporters.ipmi.port}" + "127.0.0.1:9323" + ]; + }]; + } + ]; + }; +}