core01: generalize monitoring, open up a wgmon for external nodes

This commit is contained in:
Raito Bezarius 2022-05-14 20:21:12 +02:00
parent 544df15eb1
commit 5f2a5ff782

View file

@ -1,11 +1,48 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let let
my = config.my; my = config.my;
realm = "ClubReseau"; realm = "ClubReseau";
mkChildNode = { uuid, allowFrom }: { ... }@options: ''
[${uuid}]
enabled = yes
default history = 10000
default memory mode = dbengine
health enabled by default = auto
allow from = ${allowFrom}
'';
testClusterHypervisors = lib.attrValues {
pve01 = {
uuid = "ff9a34ec-2bf4-4389-a01a-6e242424e675";
allowFrom = "fd85:27e8:0fc9::2";
};
pve02 = {
uuid = "ed393d76-e325-48c4-be90-3d7a1d3066ee";
allowFrom = "fd85:27e8:0fc9::3";
};
pve03 = {
uuid = "abeeab1f-d4f4-4ca7-aabb-54ff28031f82";
allowFrom = "fd85:27e8:0fc9::4";
};
pve04 = {
uuid = "ee0f7cec-86f8-4fa2-8258-f7bf4172eb4b";
allowFrom = "fd85:27e8:0fc9::5";
};
};
in in
{ {
services.netdata.enable = true; services.netdata.enable = true;
networking.interfaces.wireguard.wgmon = {
ips = [ "fd85:27e8:0fc9::1/48" ];
listenPort = 51820;
privateKeyFile = "/etc/secrets/wgmon";
generatePrivateKeyFile = true;
peers = [];
};
systemd.services.netdata.restartTriggers = map (v: config.environment.etc."netdata/${v}.conf".source) [ systemd.services.netdata.restartTriggers = map (v: config.environment.etc."netdata/${v}.conf".source) [
"netdata" "netdata"
"stream" "stream"
@ -27,22 +64,19 @@ in
user = "netdata"; user = "netdata";
group = "netdata"; group = "netdata";
mode = "0600"; mode = "0600";
text = '' text = (concatMapStrings map (cfg: mkChildNode cfg {})
# pve01 hypervisor [
[e245097d-bf52-4f66-9c10-984e8d5ee178] # PVE01 hypervisor
enabled = yes {
default history = 10000 uuid = "e245097d-bf52-4f66-9c10-984e8d5ee178";
default memory mode = dbengine allowFrom = "10.1.1.10";
health enabled by default = auto }
allow from = 10.1.1.10 # Public COF server
# public-cof server {
[c48e6ef1-5cdf-408d-ae2f-86aadb14e3fe] uuid = "c48e6ef1-5cdf-408d-ae2f-86aadb14e3fe";
enabled = yes allowFrom = "10.1.1.21";
default history = 10000 }
default memory mode = dbengine ]; ++ testClusterHypervisors;
health enabled by default = auto
allow from = 10.1.1.21
'';
}; };
environment.etc."netdata/health_alarm_notify.conf" = { environment.etc."netdata/health_alarm_notify.conf" = {