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" + ]; + }]; + } + ]; + }; +}