Compare commits
3 Commits
7682e01479
...
61ed39ebd7
Author | SHA1 | Date | |
---|---|---|---|
61ed39ebd7 | |||
0ec7c48f7b | |||
79dc192662 |
@ -1,6 +1,29 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
hosts = (import ../../lib/hosts.nix { inherit pkgs; }).hosts;
|
||||||
|
|
||||||
|
monitoringHosts = filterAttrs (name: host:
|
||||||
|
attrByPath ["clerie" "monitoring" "enable"] false host.config)
|
||||||
|
hosts;
|
||||||
|
|
||||||
|
monitoringHostsNames = mapAttrs' (name: host:
|
||||||
|
nameValuePair "fd00:327:327:327::${host.config.clerie.monitoring.id}" ["${host.config.networking.hostName}.mon.clerie.de"])
|
||||||
|
monitoringHosts;
|
||||||
|
|
||||||
|
monitoringPeers = mapAttrsToList (name: host: {
|
||||||
|
allowedIPs = [ "fd00:327:327:327::${host.config.clerie.monitoring.id}/128" ];
|
||||||
|
publicKey = host.config.clerie.monitoring.pubkey;
|
||||||
|
})
|
||||||
|
monitoringHosts;
|
||||||
|
|
||||||
|
monitoringTargets = mapAttrsToList (name: host:
|
||||||
|
"${host.config.networking.hostName}.mon.clerie.de:9100")
|
||||||
|
monitoringHosts;
|
||||||
|
|
||||||
|
in {
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
@ -23,21 +46,15 @@
|
|||||||
|
|
||||||
networking.hosts = {
|
networking.hosts = {
|
||||||
"fd00:327:327:327::1" = [ "monitoring-3.mon.clerie.de" ];
|
"fd00:327:327:327::1" = [ "monitoring-3.mon.clerie.de" ];
|
||||||
"fd00:327:327:327::102" = [ "porter.mon.clerie.de" ];
|
}
|
||||||
};
|
// monitoringHostsNames;
|
||||||
|
|
||||||
networking.wireguard.enable = true;
|
networking.wireguard.enable = true;
|
||||||
networking.wireguard.interfaces = {
|
networking.wireguard.interfaces = {
|
||||||
wg-monitoring = {
|
wg-monitoring = {
|
||||||
ips = [ "fd00:327:327:327::1/64" ];
|
ips = [ "fd00:327:327:327::1/64" ];
|
||||||
listenPort = 54523;
|
listenPort = 54523;
|
||||||
peers = [
|
peers = monitoringPeers;
|
||||||
{
|
|
||||||
# porter
|
|
||||||
allowedIPs = [ "fd00:327:327:327::102/128" ];
|
|
||||||
publicKey = "+mJN+ustPo2ehP0wqajYs3nTdJ0SPuIDyiZQSHFIK3o=";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
privateKeyFile = "/var/src/secrets/wireguard/wg-monitoring";
|
privateKeyFile = "/var/src/secrets/wireguard/wg-monitoring";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -69,8 +86,8 @@
|
|||||||
{
|
{
|
||||||
targets = [
|
targets = [
|
||||||
"monitoring-3.mon.clerie.de:9100"
|
"monitoring-3.mon.clerie.de:9100"
|
||||||
"porter.mon.clerie.de:9100"
|
]
|
||||||
];
|
++ monitoringTargets;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,11 @@
|
|||||||
git
|
git
|
||||||
];
|
];
|
||||||
|
|
||||||
|
clerie.monitoring = {
|
||||||
|
enable = true;
|
||||||
|
id = "201";
|
||||||
|
pubkey = "REWaiNU9AFSdDEL532XvcRul/rC79ZUfc7NOlwPSZzM=";
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "21.03";
|
system.stateVersion = "21.03";
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@
|
|||||||
clerie.monitoring = {
|
clerie.monitoring = {
|
||||||
enable = true;
|
enable = true;
|
||||||
id = "102";
|
id = "102";
|
||||||
pubkey = "";
|
pubkey = "+mJN+ustPo2ehP0wqajYs3nTdJ0SPuIDyiZQSHFIK3o=";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "21.03";
|
system.stateVersion = "21.03";
|
||||||
|
Loading…
Reference in New Issue
Block a user