From dd10a8e2fe37cb1355bf6e2e52b6f60836352622 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 23 Apr 2024 13:47:21 +0200 Subject: [PATCH] feat(ups): Use netbirdIp as given in the metadata --- machines/vault01/ups.nix | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/machines/vault01/ups.nix b/machines/vault01/ups.nix index 8df1535..15d8b9c 100644 --- a/machines/vault01/ups.nix +++ b/machines/vault01/ups.nix @@ -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 <