add bind_exporter
This commit is contained in:
parent
fbcf829d8c
commit
a1a4ba1db2
3 changed files with 28 additions and 1 deletions
|
@ -1,4 +1,10 @@
|
||||||
{ ... }: {
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
internalIP = import ../../utils/getInternalIP.nix config;
|
||||||
|
createListenEntry = ip: "inet ${ip} port 8653 allow { ${ip} };";
|
||||||
|
listenEntries = builtins.map createListenEntry internalIP.listenIPsBare;
|
||||||
|
in
|
||||||
|
{
|
||||||
services.bind = {
|
services.bind = {
|
||||||
enable = true;
|
enable = true;
|
||||||
zones = {
|
zones = {
|
||||||
|
@ -31,7 +37,18 @@
|
||||||
file = "rpz.int.chir.rs.zone";
|
file = "rpz.int.chir.rs.zone";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
statistics-channels {
|
||||||
|
${toString listenEntries}
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||||
|
services.prometheus.exporters.bind = {
|
||||||
|
enable = true;
|
||||||
|
bindGroups = [ "server" "view" "tasks" ];
|
||||||
|
bindURI = "http://${internalIP.listenIP}:8653/";
|
||||||
|
listenAddress = internalIP.listenIP;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,14 @@
|
||||||
];
|
];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "bind_exporter";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [
|
||||||
|
"${config.services.prometheus.exporters.bind.listenAddress}:${toString config.services.prometheus.exporters.bind.port}"
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
config:
|
config:
|
||||||
let
|
let
|
||||||
removeCIDR = cidr: builtins.elemAt (builtins.split "/" cidr) 0;
|
removeCIDR = cidr: builtins.elemAt (builtins.split "/" cidr) 0;
|
||||||
|
filterIPsBare = cidrs: builtins.map removeCIDR cidrs;
|
||||||
filterIPs = cidrs: builtins.map (f: "[${removeCIDR f}]") cidrs;
|
filterIPs = cidrs: builtins.map (f: "[${removeCIDR f}]") cidrs;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
listenIPs = filterIPs config.networking.wireguard.interfaces."wg0".ips;
|
listenIPs = filterIPs config.networking.wireguard.interfaces."wg0".ips;
|
||||||
|
listenIPsBare = filterIPsBare config.networking.wireguard.interfaces."wg0".ips;
|
||||||
listenIP = builtins.elemAt listenIPs 0;
|
listenIP = builtins.elemAt listenIPs 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue