Some other useful stuff when working with NMA and Prowl/Growl. We use a PowerShell script to call both and a bit of crude munging to allow PRTG to pass the priority (i.e. the * * * * in the UI) of an alert through to the PDA:
param($server, $shortname, $status, $datetime, $group, $prioritytext, $down, $message, $lastvalue)
$nmaurl = 'https://www.notifymyandroid.com/publicapi/notify'
$nmaapikey = '<yourapikeyhere>'
$priority = [regex]::matches($prioritytext,"\*").Count
$priority = $priority-3
$parameters = 'apikey=' + $nmaapikey + '&application=PRTG&event=' + $server + ' ' + $shortname + ' ' + $status + '&description=' + $datetime + ' ' + $group + ' Last value: ' + $lastvalue + '&priority=' + $priority
$http2 = New-Object -ComObject Msxml2.XMLHTTP
$http2.open('POST', $nmaurl, $false)
$http2.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
$http2.setRequestHeader("Content-length", $parameters.length)
$http2.setRequestHeader("Connection", "close")
$http2.send($parameters)
$http2.statusText
Drop this into the Notifications folder as a .ps1 file and then just wire up a notification to run this with the following parameters:
'%server' '%shortname' '%status' '%datetime' '%group' '%prioritytext' '%down' '%message' '%lastvalue'
(Single quotes for PowerShell params!)
We use seperate notificatons for "up" and "down" alerts as down alerts always go out with the correct priority, but "up" alerts always go out at the lowest priority. Using this, NMA has a cool feature to silence alerts at night apart from Emergency (i.e. 5-star) alerts. This is awesome when you have over 3000 rather chatty sensors as we do! I also have an escalation version of this script that *only* sends emergency notifications through, which is quite a nice way to work around the slightly clunky PRTG notification platform.
We use the same scripts for Prowl too as it's very nearly the same API, so we can support both the filthy, evil iPhone users and the great, noble Android heroes. (no bias here, of course)
If anyone has any other suggestions on how to use this, please post here as I'm sure it would be useful to all.
Add comment