forked from DGNum/infrastructure
Ryan Lahfa
e0cf11276d
This needs an update in our node_exporter dashboard but nothing too hard. Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
57 lines
1 KiB
Nix
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 ];
|
|
};
|
|
}
|