dotfiles/system/hosts/router/metrics.nix

105 lines
2.6 KiB
Nix
Raw Normal View History

{ config
, router-lib
2023-08-13 18:08:34 +07:00
, lib
, ... }:
let
cfg = config.router-settings;
netAddresses.lan4 = (router-lib.parseCidr cfg.network).address;
in {
services.prometheus.exporters = {
node = {
enable = true;
enabledCollectors = [ "logind" "systemd" ];
listenAddress = netAddresses.lan4;
port = 9101; # cups is 9100
};
process = {
enable = true;
listenAddress = netAddresses.lan4;
};
unbound = {
enable = true;
2024-11-24 11:21:02 +07:00
# controlInterface = "/run/unbound/unbound.ctl";
2024-11-24 13:48:31 +07:00
unbound.host = "unix:///run/unbound/unbound.ctl";
listenAddress = netAddresses.lan4;
group = config.services.unbound.group;
};
kea = {
enable = true;
controlSocketPaths = [
2023-08-13 18:08:34 +07:00
config.router.interfaces.br0.ipv4.kea.settings.control-socket.socket-name
config.router.interfaces.br0.ipv6.kea.settings.control-socket.socket-name
];
listenAddress = netAddresses.lan4;
};
2024-01-27 03:57:21 +07:00
ping2 = {
enable = true;
listenAddress = netAddresses.lan4;
port = 9380;
config = {
type = "raw";
targets = [
"8.8.8.8"
{ target = "8.8.8.8"; netns = "wan"; }
];
};
};
};
2023-08-13 18:08:34 +07:00
router.interfaces.br0 = let
# all of this just to avoid logging commands...
keaLogs = v: [
"alloc-engine"
"auth"
"bad-packets"
"database"
"ddns"
"dhcp${toString v}"
"dhcpsrv"
"eval"
"hosts"
"leases"
"options"
"packets"
"tcp"
];
in {
ipv4.kea.settings = {
control-socket = {
2023-10-25 18:04:07 +07:00
socket-name = "/run/kea4-br0/kea.sock";
2023-08-13 18:08:34 +07:00
socket-type = "unix";
};
loggers = lib.toList {
name = "kea-dhcp4";
severity = "WARN";
output_options = [ { output = "syslog"; } ];
} ++ map (name: {
name = "kea-dhcp4.${name}";
severity = "INFO";
output_options = [ { output = "syslog"; } ];
}) (keaLogs 4);
};
2023-08-13 18:08:34 +07:00
ipv6.kea.settings = {
control-socket = {
2023-10-25 18:04:07 +07:00
socket-name = "/run/kea6-br0/kea.sock";
2023-08-13 18:08:34 +07:00
socket-type = "unix";
};
loggers = lib.toList {
name = "kea-dhcp6";
severity = "WARN";
output_options = [ { output = "syslog"; } ];
} ++ map (name: {
name = "kea-dhcp6.${name}";
severity = "INFO";
output_options = [ { output = "syslog"; } ];
}) (keaLogs 6);
};
ipv6.corerad.settings.debug = {
address = "${netAddresses.lan4}:9430";
prometheus = true;
};
};
services.unbound.settings.server = {
extended-statistics = true;
};
}