node_exporter: enable on vno1 subnet

This commit is contained in:
Motiejus Jakštys 2023-09-18 19:29:27 +03:00
parent 563ccd613a
commit c822cc95c2
2 changed files with 13 additions and 4 deletions

View File

@ -74,8 +74,11 @@ in {
};
services = {
node_exporter.enable = true;
sshguard.enable = false;
node_exporter = {
enable = true;
extraSubnets = [myData.subnets.vno1.cidr];
};
tailscale = {
enable = true;
silenceLogs = true;

View File

@ -3,12 +3,18 @@
lib,
myData,
...
}: {
}: let
cfg = config.mj.services.node_exporter;
in {
options.mj.services.node_exporter = with lib.types; {
enable = lib.mkEnableOption "Enable node_exporter";
extraSubnets = lib.mkOption {
type = listOf str;
default = [];
};
};
config = lib.mkIf config.mj.services.node_exporter.enable {
config = lib.mkIf cfg.enable {
services.prometheus.exporters.node = {
enable = true;
enabledCollectors = ["systemd" "processes"];
@ -29,7 +35,7 @@
mj.services.friendlyport.ports = [
{
subnets = [myData.subnets.tailscale.cidr];
subnets = [myData.subnets.tailscale.cidr] ++ cfg.extraSubnets;
tcp = [myData.ports.exporters.node];
}
];