What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can I use the HTTP API to *add* a comment or an entry to the history log of the sensor?

Votes:

0

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.

api custom-notification http-api log prtg

Created on May 2, 2016 9:15:16 PM

Last change on May 3, 2016 12:45:14 PM by  Luciano Lingnau [Paessler]



Best Answer

Accepted 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
  1. The sensor's status will switch to "Down Acknowledged", which means that it will no longer trigger new notifications until it comes up.
  2. 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).
  3. 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,

Created on May 5, 2016 8:45:28 AM by  Luciano Lingnau [Paessler]



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

Sounds like a plan, thanks!

Created on May 4, 2016 10:52:29 PM



Votes:

0

One more add on question. Is there a way to add a log entry for this sensor using the API?

Created on May 5, 2016 3:59:23 AM



Accepted 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
  1. The sensor's status will switch to "Down Acknowledged", which means that it will no longer trigger new notifications until it comes up.
  2. 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).
  3. 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,

Created on May 5, 2016 8:45:28 AM by  Luciano Lingnau [Paessler]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.