feat: Server monitroing, NixOS 24.05 (#84)

Co-authored-by: nhnn <nhnn@disroot.org>
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config/pulls/84
This commit is contained in:
Inex Code
2024-07-30 19:19:06 +03:00
parent a6caa18981
commit 5218868b33
12 changed files with 195 additions and 102 deletions

View File

@@ -1,6 +1,8 @@
{config, lib, ...}: let
{ config, lib, ... }:
let
cfg = config.selfprivacy.modules.monitoring;
in {
in
{
options.selfprivacy.modules.monitoring = {
enable = lib.mkOption {
default = false;
@@ -21,6 +23,12 @@ in {
];
};
};
services.cadvisor = {
enable = true;
port = 9003;
listenAddress = "127.0.0.1";
extraOptions = [ "--enable_metrics=cpu,memory,diskIO" ];
};
services.prometheus = {
enable = true;
port = 9001;
@@ -40,7 +48,23 @@ in {
targets = [ "127.0.0.1:9002" ];
}];
}
{
job_name = "cadvisor";
static_configs = [{
targets = [ "127.0.0.1:9003" ];
}];
}
];
};
systemd = {
services = {
prometheus.serviceConfig.Slice = "monitoring.slice";
prometheus-node-exporter.serviceConfig.Slice = "monitoring.slice";
cadvisor.serviceConfig.Slice = "monitoring.slice";
};
slices.monitoring = {
description = "Monitoring service slice";
};
};
};
}