feat(ups): Use netbirdIp as given in the metadata
All checks were successful
build configuration / build_web02 (push) Successful in 1m6s
build configuration / build_rescue01 (push) Successful in 1m12s
build configuration / build_storage01 (push) Successful in 1m15s
build configuration / build_compute01 (push) Successful in 1m16s
build configuration / build_vault01 (push) Successful in 1m16s
lint / check (push) Successful in 23s
build configuration / build_web01 (push) Successful in 1m37s
build configuration / push_to_cache (push) Successful in 2m13s

This commit is contained in:
Tom Hubrecht 2024-04-23 13:47:21 +02:00
parent 4296252fcc
commit dd10a8e2fe

View file

@ -1,23 +1,29 @@
{
pkgs,
lib,
config,
lib,
pkgs,
meta,
name,
...
}:
{
power.ups = {
enable = true;
ups.eaton = {
driver = "usbhid-ups";
port = "auto";
};
users.eatonmon = {
passwordFile = config.age.secrets."eatonmon-password_file".path;
upsmon = "primary";
};
upsmon.monitor.eaton = {
user = "eatonmon";
};
schedulerRules =
let
cmdScript = pkgs.writeShellApplication {
@ -28,12 +34,12 @@
];
text = ''
case $1 in
shutdown-low) MEANING="Battery is low, shutting down.";;
shutdown-low) MEANING="Battery is low, shutting down.";;
shutdown-batt) MEANING="On battery for 15min, shutting down.";;
warn-batt) MEANING="Power line faillure, going on battery.";;
warn-comm) MEANING="Communication with the UPS was broken.";;
warn-bypass) MEANING="The UPS is not protecting the server, power line failure would kill $HOSTNAME instantly.";;
*) MEANING="Signal unknown, check configuration.";;
warn-batt) MEANING="Power line faillure, going on battery.";;
warn-comm) MEANING="Communication with the UPS was broken.";;
warn-bypass) MEANING="The UPS is not protecting the server, power line failure would kill $HOSTNAME instantly.";;
*) MEANING="Signal unknown, check configuration.";;
esac
sendmail -i -t <<ERRMAIL
To: fai+monitoring@dgnum.eu
@ -84,8 +90,9 @@
services.prometheus.exporters.nut = {
enable = true;
listenAddress = "100.80.255.180";
listenAddress = meta.network.${name}.netbirdIp;
port = 9199;
};
networking.firewall.interfaces.wt0.allowedTCPPorts = [ 9199 ];
}