Add monitoring in the bay node

This commit is contained in:
Rodrigo Arias 2023-08-29 11:53:32 +02:00
parent fad9df61e1
commit 5bd1d67333
2 changed files with 26 additions and 0 deletions

View File

@ -3,6 +3,7 @@
{ {
imports = [ imports = [
../common/main.nix ../common/main.nix
./monitoring.nix
]; ];
# Select the this using the ID to avoid mismatches # Select the this using the ID to avoid mismatches

25
m/bay/monitoring.nix Normal file
View File

@ -0,0 +1,25 @@
{ config, lib, ... }:
{
# We need access to the devices to monitor the disk space
systemd.services.prometheus-node-exporter.serviceConfig.PrivateDevices = lib.mkForce false;
systemd.services.prometheus-node-exporter.serviceConfig.ProtectHome = lib.mkForce "read-only";
# Required to allow the smartctl exporter to read the nvme0 character device,
# see the commit message on:
# https://github.com/NixOS/nixpkgs/commit/12c26aca1fd55ab99f831bedc865a626eee39f80
services.udev.extraRules = ''
SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk"
'';
services.prometheus = {
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
smartctl.enable = true;
};
};
}