Smartd push notifications using Pushover

I implemented this on a storage server I manage and I thought it was something someone might be interested in implementing.

Pushover is a service for push notifications. It has a very simple API that can be touched with cURL to get instant notifications on mobile devices.

I implemented this by adding the following lines to the top of /usr/libexec/smartmontools/smartdnotify:

# Send push notification using pushover
APP_TOKEN=""
USER_TOKEN=""

curl -s \
--form-string "token=$APP_TOKEN" \                                                                                                                                                
--form-string "user=$USER_TOKEN" \                                                                                                                                                
--form-string "title=S.M.A.R.T. error detected on $HOSTNAME" \
--form-string "message=$SMARTD_MESSAGE" \
https://api.pushover.net/1/messages.json

All one needs to do is set up an application on the Pushover website and enter the details in the script. It would be cool if Rockstor had a UI option to enter the app and user token, and when enabled push notifications would be sent for SMART errors for instant notification. This is much simper than setting up an SMTP server for email notifications.

I looked at how to implement this in the Rockstor source but without shipping your own version of smartmontools I don’t see how it’s possible so I’m going to leave that to existing devs to determine how to implement if it’s desired.

The push notifications look like this:

2 Likes