We use an External Program to send a SOAP call to our ticketing system, Service Now and they respond with an incident number. Is there a way to get that incident number back into sensor either in the history log or in the comments.
Can I use the HTTP API to *add* a comment or an entry to the history log of the sensor?
Votes:
0
Best Answer
Votes:
0
Hello Mike,
thank you for your reply.
Unfortunately not, it's also not possible to manually add entries to the log, it can only be modified by sensor-related operations. You could however do something very cool which hadn't occurred to me earlier:
If you're alerting for DOWN sensors (And only down, not Warning and not threshold notifications for Up sensors) you will be able to Acknowledge the sensor via the API using the code below, which will trigger the following consequences:
http://prtg/api/acknowledgealarm.htm?id=%sensorid&ackmsg=Ticket%20Created%20-%20123456&username=myusername&passhash=12345678
- The sensor's status will switch to "Down Acknowledged", which means that it will no longer trigger new notifications until it comes up.
- You will be able to enter a "Description" for the Acknowldegment, which will be appended to the sensor's Last Message(in the overview of the sensor).
- A log entry will be added to the sensor's log, for instance: "Ticket Created - 123456 (Acknowledged at 05.05.2016 10:39:40 by API User)", where "Ticket Created - 123456" is a text string that you can define).
Best Regards,
4 Replies
Votes:
1
Hello Mike,
thank you for your post.
If you're using an exe/script as Execute Program notification, then yes. The workflow should be the following:
1. PRTG runs the "Execute Program" notification, it can be configured to forward the %sensorid or
%deviceid to the script/program.
2. The script/program does the SOAP-Call "business" (notification).
3. The script uses the incident number or any other info contained in the reply of the SOAP operation and uses the HTTP API to set the value for the comments of the device or sensor.
The PRTG API call to set the comment will look as follows:
http://prtg/api/setobjectproperty.htm?id=1234&name=comments&value=New%20Comment
Where 1234 is the ID of the sensor or device and New%20Comment is the value to be set in the comments field. Please note that this will REPLACE any existing value for the comments field, so you may consider using the getobjectproperty.htm call first to get the existing value of the field and then appending it to the new comment.
For more information, see PRTG Manual: Application Programming Interface (API) Definition.
Note:
All API calls must either provide a &username=XXXXXXXXXX and &password=XXXXXXXXXXX or &passhash=XXXXXXX to for access control.
Best Regards,
Luciano Lingnau [Paessler Support]
Created on May 3, 2016 12:44:16 PM by
Luciano Lingnau [Paessler]
Last change on Jul 24, 2018 7:45:43 AM by
Brandy Greger [Paessler Support]
Votes:
0
One more add on question. Is there a way to add a log entry for this sensor using the API?
Votes:
0
Hello Mike,
thank you for your reply.
Unfortunately not, it's also not possible to manually add entries to the log, it can only be modified by sensor-related operations. You could however do something very cool which hadn't occurred to me earlier:
If you're alerting for DOWN sensors (And only down, not Warning and not threshold notifications for Up sensors) you will be able to Acknowledge the sensor via the API using the code below, which will trigger the following consequences:
http://prtg/api/acknowledgealarm.htm?id=%sensorid&ackmsg=Ticket%20Created%20-%20123456&username=myusername&passhash=12345678
- The sensor's status will switch to "Down Acknowledged", which means that it will no longer trigger new notifications until it comes up.
- You will be able to enter a "Description" for the Acknowldegment, which will be appended to the sensor's Last Message(in the overview of the sensor).
- A log entry will be added to the sensor's log, for instance: "Ticket Created - 123456 (Acknowledged at 05.05.2016 10:39:40 by API User)", where "Ticket Created - 123456" is a text string that you can define).
Best Regards,
Add comment