I'd like to add a URL to our email template that allows the on-call personnel to acknowledge alarms without having to login to the web interface. This would be primarily used on mobile devices.
Is there a way to single-click acknowledge an alarm by adding a URL to the email template?
Votes:
2
Best Answer
Votes:
3
This is possible as of PRTG 7.3.2
As of 7.3.2 the %sensorid placeholder is supported, so we can now edit the HTML template and insert something like:
<div class="url"> <a href="http://192.168.1.2:8080/api/acknowledgealarm.htm?id=%sensorid&ackmsg=ok&username=admin&passhash=12345678"><h3>Acknowledge alarm</h3><a> </div>
The top section of the HTML template would than look like:
<!-- HTML Template per Notification BEGIN --> <div class="head"> <b>%device</b>: %name %status %down (%message) </div> <div class="url"> <a href="http://192.168.1.2:8080/api/acknowledgealarm.htm?id=%sensorid&ackmsg=ok&username=admin&passhash=12345678"><h3>Acknowledge alarm</h3><a> </div> <div class="content">
You have to change the IP and portnumber to match your own PRTG installation. Also the username (admin) and passhash (12345678) are just for example purpose and have to be changed.
The user that receives the email is now presented with a link to acknowledge the alarm.
Created on Mar 9, 2010 9:28:37 AM
Last change on Jul 15, 2010 8:44:26 AM by
Daniel Zobel [Product Manager]
5 Replies
Votes:
-2
Sounds like an excellent idea though and in theory at least, not too difficult to implement - just need to ensure it's secure enough so that you don't have to log in every time but that the link alone doesn't authenticate you. Perhaps a one-time authenticated link, solely for acknowledging alerts but which doesn't fully log you in.
Votes:
3
This is possible as of PRTG 7.3.2
As of 7.3.2 the %sensorid placeholder is supported, so we can now edit the HTML template and insert something like:
<div class="url"> <a href="http://192.168.1.2:8080/api/acknowledgealarm.htm?id=%sensorid&ackmsg=ok&username=admin&passhash=12345678"><h3>Acknowledge alarm</h3><a> </div>
The top section of the HTML template would than look like:
<!-- HTML Template per Notification BEGIN --> <div class="head"> <b>%device</b>: %name %status %down (%message) </div> <div class="url"> <a href="http://192.168.1.2:8080/api/acknowledgealarm.htm?id=%sensorid&ackmsg=ok&username=admin&passhash=12345678"><h3>Acknowledge alarm</h3><a> </div> <div class="content">
You have to change the IP and portnumber to match your own PRTG installation. Also the username (admin) and passhash (12345678) are just for example purpose and have to be changed.
The user that receives the email is now presented with a link to acknowledge the alarm.
Created on Mar 9, 2010 9:28:37 AM
Last change on Jul 15, 2010 8:44:26 AM by
Daniel Zobel [Product Manager]
Votes:
0
You guys are awesome. This addresses Adrian's concern because the API is stateless.
Created on Mar 25, 2010 2:57:57 PM
Last change on Jul 15, 2010 8:45:15 AM by
Daniel Zobel [Product Manager]
Votes:
1
HTML email template part 2, hide username and passhash
Adding the
http://192.168.1.2:8080/api/acknowledgealarm.htm?id=%sensorid&ackmsg=ok&username=admin&passhash=12345678
To the email template works ok, but leaves the user with the complete visible url in his browser, including the username and passhash. To hide the username and passhash, we can make things a little bit more complicated and pass our url to the checklogin.htm page.
Our basic url, (without username and passhash) now becomes the payload for the checklogin.htm and has to be url encoded. We do however want to leave the %sensorid placeholder intact, so let's break up the basic url into 3 pieces.
Basic url
http://192.168.1.2:8080/api/acknowledgealarm.htm?id= %sensorid &ackmsg=ok
The first and third line now need to be url encoded:
http%3a%2f%2f192.168.1.2%3a8080%2fapi%2facknowledgealarm.htm%3fid%3d %sensorid %26ackmsg%3dok
Putting it back together:
http%3a%2f%2f192.168.1.2%3a8080%2fapi%2facknowledgealarm.htm%3fid%3d%sensorid%26ackmsg%3dok
We now add this to the checklogin.htm and add our username and passhash:
http://192.168.1.2:8080/public/checklogin.htm?loginurl=http%3a%2f%2f192.168.1.2%3a8080%2fapi%2facknowledgealarm.htm%3fid%3d%sensorid%26ackmsg%3dok&login=admin&passhash=12345678
Making the top section of our email template look like this:
<!-- HTML Template per Notification BEGIN --> <div class="head"> <b>%device</b>: %name %status %down (%message) </div> </div class="ull"> <a href= "http://192.168.1.2:8080/public/checklogin.htm?loginurl=http%3a%2f%2f192.168.1.2%3a8080%2fapi%2facknowledgealarm.htm%3fid%3d%sensorid%26ackmsg%3dok&login=admin&passhash=12345678"><h3>Acknowledge alarm 2</h3><a> </div>
Our user is still presented with a link to acknowledge the alarm, but does not see the username and passhash in his browser anymore.
Url encoding can be done online by sites as: http://www.string-functions.com/urlencode.aspx
Created on Mar 28, 2010 5:59:09 PM
Last change on Jul 15, 2010 8:44:51 AM by
Daniel Zobel [Product Manager]
Votes:
Add comment