Basal Synthesis GmbH Apcupsd
Apcupsd
In OPNsense bietet Apcupsd wichtige UPS (Uninterruptible Power Supply)-Verwaltungsmerkmale, insbesondere für APC-UPS-Geräte. Diese Integration sichert, dass das System bei Stromausfällen effizient mit Strom umgehen kann und sichere Herunterfahrensverfahren zur Datenintegrität und Verhinderung von Hardwarebeschädigungen auslöst. Durch das ständige Überwachen des UPS-Zustands erhöht Apcupsd die Zuverlässigkeit und Resilienz des Netzwerkinfrastruktures, was OPNsense zu einer robusteren Lösung für Umgebungen macht, in denen Stromstabilität entscheidend ist.
Konfigurationen
- Installiere Apcupsd plugin in Opnsense
- Verbinde UPS hardware mit Opnsense hardware mit einem usb Kabel. Das plugin erkennt die Verbindung automatisch.
- Konfiguriere die Settings in der Oberfläche:
- Erstelle den code im in der Datei: /usr/local/etc/apcupsd/offbattery
#!/bin/sh
# Find the shessl script under /etc/apcupsd
# /etc/apcupsd/apccontrol calls the script if
# the UPS falls back to main after energy failure.
# An e-mail message will be sent to root.
echo "$(date) - offbattery script started" >> /var/log/apcupsd_eventscripts.log
HOSTNAME="APC Back-UPS"
MSG="$HOSTNAME UPS $1 Power has returned"
(
echo "Subject: $MSG"
echo " "
echo "$MSG"
echo " "
/usr/local/sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
# Wake up the hardware, which is necessary.
wake igb0 macaddress
if [ $? -eq 0 ]; then
echo "Magic packet sent successfully" >> /var/log/apcupsd_eventscripts.log
else
echo "Failed to send magic packet" >> /var/log/apcupsd_eventscripts.log
fi
# Wait for a minute to allow the server to wake up
sleep 60
- Define the code in the path /usr/local/etc/apcupsd/onbattery
#!/bin/sh
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# goes on batteries.
# We send an email message to root to notify him.
# This script send a command to run a shutDown script on a server to make a secure shutdown.
echo "$(date) - onbattery script started" >> /var/log/apcupsd_eventscripts.log
HOSTNAME=`hostname`
MSG="$HOSTNAME UPS $1 Power Failure !!!"
(
echo "Subject: $MSG"
echo " "
echo "$MSG"
echo " "
/usr/local/sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
if ssh -o BatchMode=yes user@server.example.com "sudo /path/to/script/script.sh" >> /var/log/apcupsd_eventscripts.log 2>&1; then
echo "$(date) - The /path/to/script/script.sh on server executed successfully" >> /var/log/apcupsd_eventscripts.log
else
echo "$(date) - The /path/to/script/script.sh on server executed failed" >> /var/log/apcupsd_eventscripts.log
fi
echo "$(date) - onbattery script finished" >> /var/log/apcupsd_eventscripts.log
exit 0
Status
Look at the status, if all configurations are correct it looks like:
Dashboard
The Dashboard automatically added a widget for apcupsd. I looks like:
Logs
Die apcupsd hat auch einen Log: