infrastructure/modules/nixos/dgn-node-monitoring.nix
Ryan Lahfa e0cf11276d
All checks were successful
Check meta / check_dns (pull_request) Successful in 20s
Check meta / check_meta (pull_request) Successful in 28s
Check workflows / check_workflows (pull_request) Successful in 30s
Build all the nodes / ap01 (pull_request) Successful in 1m11s
Build all the nodes / bridge01 (pull_request) Successful in 1m54s
Build all the nodes / geo01 (pull_request) Successful in 2m2s
Build all the nodes / geo02 (pull_request) Successful in 2m5s
Build all the nodes / rescue01 (pull_request) Successful in 2m28s
Build all the nodes / compute01 (pull_request) Successful in 2m50s
Build all the nodes / storage01 (pull_request) Successful in 2m15s
Run pre-commit on all files / check (pull_request) Successful in 32s
Build all the nodes / vault01 (pull_request) Successful in 1m51s
Build all the nodes / web02 (pull_request) Successful in 1m48s
Build all the nodes / web03 (pull_request) Successful in 1m43s
Build all the nodes / web01 (pull_request) Successful in 2m28s
Build all the nodes / ap01 (push) Successful in 1m28s
Build all the nodes / geo01 (push) Successful in 2m3s
Build all the nodes / bridge01 (push) Successful in 2m6s
Build all the nodes / geo02 (push) Successful in 2m13s
Build all the nodes / rescue01 (push) Successful in 2m34s
Build all the nodes / compute01 (push) Successful in 2m43s
Run pre-commit on all files / check (push) Successful in 41s
Build all the nodes / storage01 (push) Successful in 2m4s
Build all the nodes / vault01 (push) Successful in 2m9s
Build all the nodes / web02 (push) Successful in 1m58s
Build all the nodes / web03 (push) Successful in 1m56s
Build all the nodes / web01 (push) Successful in 2m48s
feat(monitoring): support cgroup exporting of metrics
This needs an update in our node_exporter dashboard but nothing too
hard.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
2024-12-11 11:08:07 +01:00

57 lines
1 KiB
Nix

{
pkgs,
sources,
config,
lib,
...
}:
let
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
cfg = config.dgn-node-monitoring;
in
{
options.dgn-node-monitoring = {
enable = mkEnableOption "DGNum nodes monitoring (needs a valid netbird tunnel)" // {
default = true;
};
port = mkOption {
type = types.port;
default = 9002;
description = lib.mdDoc ''
Port to listen on.
'';
};
};
imports = [
"${sources.cgroup-exporter}/nix/module.nix"
];
config = mkIf cfg.enable {
services.prometheus = {
exporters = {
node = {
enable = true;
enabledCollectors = [
"processes"
"systemd"
];
inherit (cfg) port;
listenAddress = "0.0.0.0";
};
cgroup = {
enable = true;
package = pkgs.callPackage "${sources.cgroup-exporter}/nix/package.nix" { };
};
};
};
networking.firewall.interfaces.wt0.allowedTCPPorts = [ cfg.port ];
};
}