Send NUT and UPS alerts to iPhone, Android, and web push notifications
Network UPS Tools, usually called NUT, can execute a custom notification command whenever important UPS events happen. That makes it easy to forward power events, battery warnings, and communication failures to Signalgrid without writing a dedicated application.
upsmon can call your script through NOTIFYCMD. Your script can read NOTIFYTYPE and UPSNAME, receive the human-readable message from NUT, map the event to a Signalgrid notification type, and then post it to the Signalgrid Push API.
What This Setup Covers
- UPS switched to battery power
- UPS battery is low or critical
- Communication loss with the UPS
- Battery replacement warnings
- Power restored notifications
- System shutdown warnings triggered by NUT
Prerequisites
- A working NUT installation with
upsmon - A machine that can reach
https://api.signalgrid.co - A Signalgrid account
- Your Signalgrid
client_key - Your Signalgrid channel token
curlinstalled on the system
Signalgrid Notify Script
Create a small shell script such as /usr/local/bin/signalgrid-ups-notify.sh:
Make The Script Executable
Configure upsmon.conf
Point NOTIFYCMD at your script and enable EXEC on the notification types you want to forward:
You do not need to enable every possible NUT event on day one. Start with the events that matter most for your setup, such as ONBATT, LOWBATT, COMMBAD, COMMOK, and ONLINE.
How The Mapping Works
ONLINE, COMMOKtype=SUCCESS to mark recovery or restored serviceONBATT, REPLBATT, ALARMtype=WARN for warning-level UPS conditionsLOWBATT, COMMBAD, NOCOMM, SHUTDOWNtype=CRIT and critical=true for urgent failures and shutdown conditionsTest The Script Manually
You can simulate a NUT warning without waiting for a real power event:
If the integration works, you should receive a Signalgrid warning notification on devices subscribed to the selected channel.
Optional: Add Delay Logic Later
If your UPS briefly flips to battery during short power blips, you may later want to add delay logic with upssched. But for a straightforward first integration, a direct NOTIFYCMD shell script is often enough.
Troubleshooting
client_key, channel token, outbound network access, and that the script path in NOTIFYCMD is correctNOTIFYFLAG lines include EXECNOTIFYTYPE, UPSNAME, and the incoming message to inspect what NUT is actually passing to your script