NUT UPS Push Notifications

Updated on September 05, 2026 Network UPS Tools Git Repository

Send NUT and UPS alerts to iPhone, Android, and web push notifications
using a small shell script with the upsmon NOTIFYCMD hook.

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
  • curl installed on the system

Signalgrid Notify Script

Create a small shell script such as /usr/local/bin/signalgrid-ups-notify.sh:

Bash
#!/bin/sh SIGNALGRID_CLIENT_KEY="YOUR_CLIENT_KEY" SIGNALGRID_CHANNEL="YOUR_CHANNEL_TOKEN" SIGNALGRID_API="https://api.signalgrid.co/v1/push" NOTIFY_TYPE="${NOTIFYTYPE:-UNKNOWN}" UPS_NAME="${UPSNAME:-unknown-ups}" MESSAGE="$1" TITLE="UPS ${UPS_NAME}: ${NOTIFY_TYPE}" TYPE="INFO" CRITICAL="false" case "$NOTIFY_TYPE" in ONLINE|COMMOK|NOTALARM|NOTBYPASS|NOTOFF|NOTOTHER|SUSPEND_FINISHED) TYPE="SUCCESS" ;; ONBATT|CAL|BYPASS|ECO|ALARM|REPLBATT|TRIM|BOOST|SUSPEND_STARTING) TYPE="WARN" ;; LOWBATT|FSD|COMMBAD|NOCOMM|SHUTDOWN|SHUTDOWN_HOSTSYNC|NOPARENT|OVER) TYPE="CRIT" CRITICAL="true" ;; *) TYPE="INFO" ;; esac curl -sS -X POST "$SIGNALGRID_API" \ --data-urlencode "client_key=$SIGNALGRID_CLIENT_KEY" \ --data-urlencode "channel=$SIGNALGRID_CHANNEL" \ --data-urlencode "title=$TITLE" \ --data-urlencode "body=$MESSAGE" \ --data-urlencode "type=$TYPE" \ --data-urlencode "critical=$CRITICAL"

Make The Script Executable

Bash
chmod +x /usr/local/bin/signalgrid-ups-notify.sh

Configure upsmon.conf

Point NOTIFYCMD at your script and enable EXEC on the notification types you want to forward:

Config
NOTIFYCMD "/usr/local/bin/signalgrid-ups-notify.sh" NOTIFYFLAG ONLINE SYSLOG+EXEC NOTIFYFLAG ONBATT SYSLOG+EXEC NOTIFYFLAG LOWBATT SYSLOG+EXEC NOTIFYFLAG COMMBAD SYSLOG+EXEC NOTIFYFLAG COMMOK SYSLOG+EXEC NOTIFYFLAG REPLBATT SYSLOG+EXEC NOTIFYFLAG NOCOMM SYSLOG+EXEC NOTIFYFLAG SHUTDOWN SYSLOG+EXEC

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

NUT event
Signalgrid mapping
ONLINE, COMMOK
type=SUCCESS to mark recovery or restored service
ONBATT, REPLBATT, ALARM
type=WARN for warning-level UPS conditions
LOWBATT, COMMBAD, NOCOMM, SHUTDOWN
type=CRIT and critical=true for urgent failures and shutdown conditions

Test The Script Manually

You can simulate a NUT warning without waiting for a real power event:

Bash
NOTIFYTYPE=ONBATT UPSNAME=ups@localhost /usr/local/bin/signalgrid-ups-notify.sh "UPS is on battery"

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

Issue
What to check
No Signalgrid notification arrives
Verify your client_key, channel token, outbound network access, and that the script path in NOTIFYCMD is correct
The script never runs
Confirm the file is executable and that the relevant NOTIFYFLAG lines include EXEC
The UPS event seems wrong
Log NOTIFYTYPE, UPSNAME, and the incoming message to inspect what NUT is actually passing to your script