configure apcupsd server
This commit is contained in:
parent
7c772395de
commit
a0832392b9
@ -61,7 +61,8 @@
|
|||||||
|
|
||||||
nftables.enable = true;
|
nftables.enable = true;
|
||||||
firewall.extraInputRules = ''
|
firewall.extraInputRules = ''
|
||||||
meta l4proto esp counter accept comment "allow ipsec"
|
meta l4proto esp counter accept comment "allow IPsec"
|
||||||
|
ip saddr 192.168.1.0/24 tcp dport apcupsd accept comment "allow UPS from LAN"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
usePredictableInterfaceNames = false;
|
usePredictableInterfaceNames = false;
|
||||||
|
33
hardware.nix
33
hardware.nix
@ -38,36 +38,33 @@
|
|||||||
UPSTYPE usb
|
UPSTYPE usb
|
||||||
UPSCABLE usb
|
UPSCABLE usb
|
||||||
NETSERVER on
|
NETSERVER on
|
||||||
NISPORT 3551
|
|
||||||
MINUTES 5
|
MINUTES 5
|
||||||
'';
|
'';
|
||||||
hooks =
|
hooks =
|
||||||
let
|
let
|
||||||
# Send notifications on the Maxwell
|
# Send notifications when something bad happens
|
||||||
# room when something bad happens.
|
|
||||||
notify = msg: ''${pkgs.maxwell-notify}/bin/notify "UPS: ${msg}"'';
|
notify = msg: ''${pkgs.maxwell-notify}/bin/notify "UPS: ${msg}"'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
changeme = notify "sostituire le batterie";
|
changeme = notify "replace batteries";
|
||||||
battdetach = notify "batterie disconnesse";
|
battdetach = notify "batteries disconnected";
|
||||||
battattach = notify "batterie riconnesse";
|
battattach = notify "batteries reconnected";
|
||||||
commfailure = notify "connessione persa";
|
commfailure = notify "connection lost";
|
||||||
commok = notify "connessione ristabilita";
|
commok = notify "connection enstablished";
|
||||||
loadlimit = notify "livello batterie critico (5%)";
|
loadlimit = notify "critical battery level (5%)";
|
||||||
runlimit = notify "autonomia batterie critico (5min)";
|
runlimit = notify "critical battery life (5min)";
|
||||||
doshutdown = notify "inizio sequenza di spegnimento";
|
doshutdown = notify "shutting down!";
|
||||||
powerout = notify "rete elettrica disconnessa";
|
powerout = notify "main power is out";
|
||||||
mainsback = notify "rete elettrica riconnessa";
|
mainsback = notify "main power is back";
|
||||||
onbattery = notify "attivate batterie";
|
onbattery = notify "batteries connected";
|
||||||
offbattery = notify "disattivate batterie";
|
offbattery = notify "batteries disconnected";
|
||||||
emergency = notify "malfunzionamento batterie, possibile spegnimento!";
|
emergency = notify "battery malfunction, possible shutdown!";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.smartd =
|
services.smartd =
|
||||||
let
|
let
|
||||||
# Send a notification on the Maxwell
|
# Send a notification when a disk is starting to fail
|
||||||
# when a disk is starting to fail.
|
|
||||||
failHook = with pkgs; writeScript "disk-fail-hook" ''
|
failHook = with pkgs; writeScript "disk-fail-hook" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
${pkgs.maxwell-notify}/bin/notify \
|
${pkgs.maxwell-notify}/bin/notify \
|
||||||
|
Loading…
Reference in New Issue
Block a user