I’m a huge fan of the Pushover Simple Notification Service for receiving critical alerts about the servers for which I am responsible. It’s beautifully simple — in short, it takes the ‘walled garden’ of Google or Apple’s push notification system and extends it, so that you can push any text notification you want through their API, and it’ll get to your phone.
In this post, I will share how I get critical alerts from a Microsoft System Center Operations Manager instance to Pushover.
Create a Pushover App
We will log in to the Pushover web interface and choose to create a new application/plugin.
Create a sensible name/description and choose the Script type.
Make a note of the API key of this new app, as well as your ‘user key’ from the main Pushover page.
Download cURL for Windows
On the SCOM management server from which you want to send the notifications, download and install cURL for Windows. For those not in the know, cURL is a very simple tool we can use to make HTTP requests. All we have to do is, when there is an alert we care about, instruct cURL to POST to the Pushover endpoint, sending the app token, user token, the message title and the message body.
It’s easiest to go for a pre-built distribution of cURL for Windows that will provide you with a certificate bundle. The MSI installer provided by Confused by Code is linked to from the cURL site and should work well, but use at your own risk!
Hopefully, cURL is now in Program Files:
Add a Notification Channel in SCOM
In the SCOM Console, head on over to Administration. Expand the Notifications tree and select Channels.
In the right-hand pane, add a new channel, and choose Command as the type.
On the Settings page of the wizard, we’ll put the following settings:
- Full path of the command file:
C:\Program Files\cURL\bin\curl.exe(nothing else!)
- Command line parameters, substituting in the two tokens:
-F "token=APP_TOKEN" -F "user=USER_TOKEN" -F "title=$Data[Default='Not Present']/Context/DataItem/ResolutionStateName$ Alert: $Data[Default='Not Present']/Context/DataItem/AlertName$" -F "message=$Data[Default='Not Present']/Context/DataItem/ResolutionStateName$ $Data[Default='Not Present']/Context/DataItem/AlertName$ $Data[Default='Not Present']/Context/DataItem/AlertDescription$" https://api.pushover.net/1/messages.json
- Startup folder for the command line:
In our environment, we also need a HTTP proxy configured for cURL to get out to the internet, which we add to the arguments:
There’s also a lot of customisation you can do to the title and message POST data in the cURL command if you desire different information in your phone’s copy of the notification. The arrow button in the Settings wizard page can be used to insert other fields. My goal is just to see the status (New, Closed, etc.) and the description. The alert to my phone should give me just enough context to decide whether or not further investigation is warranted!
Now the channel is configured.
Add a Subscriber and Address for this Notification Channel
The channel alone won’t do anything — we now need to add a Subscriber in SCOM that attaches to this new Channel. Back in the SCOM Administration area, click on Subscribers under Notifications and create a new Subscriber.
Provide the description and schedule according to your needs. On the Addresses page of the wizard, add a new Address.
All you need to do is select the Command Channel Type and choose the new Channel we added earlier. Note that no delivery address actually needs to be entered.
Finish both the Address wizard and the Subscriber wizard.
Add the Pushover Subscriber to a Subscription
In our environment, we already have a Critical Alerts Subscription set up, which sends emails to various subscribers already. So, we now just need to edit this Subscription and add the new Subscriber for the Pushover app.
On the Subscribers page of the wizard to create or edit a Subscription, click Add (not New) and add in the Pushover subscriber.
The process seems a little fiddly because of the four different SCOM objects involved: the new Channel, the new Subscriber for that Channel, the Address attached to that Subscriber, and then the Subscription that has that Subscriber in it. (Phew!)
Once all of those items are configured, though, the next time you break something and trigger an alert, SCOM will invoke cURL, making a request to the Pushover API. As long as your server can talk to Pushover, and your API keys are correct, you should get the notification on your Pushover-enabled device.