Prowl notifications with apcupsd

I use Prowl to deliver push notifications to my iPhone for various things like sabnzbd completions and, now, apcupsd notifications. It's relatively easy to accomplish with a simple script to fire notifications at the Prowl service:

curl -s \
     -d apikey=YOUR_API_KEY_HERE \
     -d priority="$1" \
     -d application=apcupsd \
     -d event="$2" \
     -d description="$3" \

Replace YOUR_API_KEY_HERE with your Prowl API key, drop the script in /etc/apcupsd and then add relevant lines to your /etc/apcupsd/apccontrol script:



case "$1" in
        ${PROWL} 1 "apcupsd" "Power failure on UPS ${2}. Running on batteries."
        ${PROWL} 2 "apcupsd" "Battery power exhausted. Shutting down."

The number in the script commandline is the priority of the alert: 2 is for emergencies and bypasses my Prowl silent mode, as I found out when my UPS ran out of battery power this weekend.