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

HTTP JSON/REST Sensor Feature Request

Votes:

0

Hi,

I find the HTTP XML/REST Value Sensor very useful for monitoring services over web APIs, however, I am encountering an increasing number of RESTful web services out there that respond exclusively in application/json format.

Do you by chance have any plans to introduce a similar sensor that reads JSON output?

Thank you

-Ed

prtg rest

Created on Dec 13, 2011 6:51:41 PM



6 Replies

Accepted Answer

Votes:

1

Checking JSON

With the XML Node (and optional property) field of the HTTP XML/REST Value sensor, you can also check values that are returned in JavaScript Object Notation (JSON) notation under the defined URL.

Example

A JSON notated section may look like the following:

{
   "test": "Hello World",
   "object": {
      "value": "content",
      "AnotherValue": "AnotherContent"
   },
   "arraytest": [
      "one",
      "two"
   ]
}


Depending on your entries in the XML Node field, the sensor will process the respective values:

Entry in Sensor's "XML Node" Field (from Example Above)Processed Value (from Example Above)
testHello World
object/valuecontent
object/AnotherValueAnotherContent
objectcontentAnotherContent
arraytest[0]one
arraytest[1]two

Created on Dec 14, 2011 1:59:39 PM by  Daniel Zobel [Product Manager]

Last change on Jan 16, 2014 12:18:16 PM by  Gerald Schoch [Paessler Support]



Votes:

0

Feature Request

We are running multiple Rabbit MQ services which are monitorable via an API which in turn returns results via JSON.

Instead of creating 50 different REST sensors, would it be possible to define multiple channels on the same sensor?

An example of the JSON that comes out of the RabbitMQ service is

{"management_version":"2.7.1","statistics_level":"fine","message_stats":
{"publish":3371381,"publish_details":
{"rate":0,"interval":641379049,"last_event":1332232592280},"ack":2435,"ack_details":
{"rate":0.5845674201091193,"interval":5132000,"last_event":1332263428950},"deliver":3435,"deliver_details":
{"rate":0.5845674201091193,"interval":5132000,"last_event":1332263428950},"deliver_get":3435,"deliver_get_details":
{"rate":0.5845674201091193,"interval":5132000,"last_event":1332263428950},"redeliver":2731,"redeliver_details":
{"rate":0.0,"interval":5132000,"last_event":1332263428950}},"queue_totals":
{"messages":17014284,"messages_ready":17013284,"messages_unacknowledged":1000,"messages_details":
{"rate":-0.5845674201091193,"interval":338743284980,"last_event":1332263428950},"messages_ready_details":
{"rate":-0.5845674201091193,"interval":338743284980,"last_event":1332263428950},"messages_unacknowledged_details":
{"rate":0.0,"interval":338743284980,"last_event":1332263428950}},"node":"rabbit@NLRTD-RMQ01","statistics_db_node":"rabbit@NLRTD-RMQ01","listeners":
[{"node":"rabbit@NLRTD-RMQ01","protocol":"amqp","ip_address":"0.0.0.0","port":5672},{"node":"rabbit@NLRTD-RMQ01","protocol":"amqp","ip_address":"::","port":5672}],"contexts":
[{"node":"rabbit@NLRTD-RMQ01","description":"RabbitMQ Management","path":"/","port":55672}]}

There are multiple valuable parts of this JSON I would like to render in PRTG but now I have to write an intermediate (PHP) script.

Could this be added to PRTG?

Created on Mar 23, 2012 2:18:48 PM

Last change on Feb 27, 2013 1:33:35 PM by  Daniel Zobel [Product Manager]



Votes:

0

Hi Megamuch,

we are currently looking into this issue and come back to you as soon as possible.

What i can say by now is that we think its an important feature, but we need to make sure that the configuration don't get too complicated.

Regards, Daniel

Created on Apr 5, 2012 9:14:56 AM by  Daniel Elsner [Paessler Support]

Last change on Apr 5, 2012 9:40:01 AM by  Daniel Zobel [Product Manager]



Votes:

0

@Megamuch, can you please post your script? We are also preparing to monitor Rabbit, but 50+ sensors seems wasteful of probe and rabbit server resources.

Created on Sep 14, 2012 4:17:55 PM



Votes:

0

Hi All,

I would love to see an example of settings / script for this sensor. I too am attempting to monitor RabbitMQ for various 'business' requirements (panic about queue depth, unacks due to flakey dev techniques on a web app), and have zero exposure to json / xpath etc.

When running queries against rabbitmq's api from curl, I almost get what I need. Translating this into the sensor has been a ton of frustration.

Created on Feb 21, 2013 12:16:15 AM



Votes:

0

You can query every item of interest in a JSON document by specifying the node in an HTTP XML/REST Sensor. Add this sensor to PRTG and enter the URL to be requested for a JSON document.

Consider the example JSON code above taken from RabbitMQ. You can query items by providing, for example, the following entries in the XML Node (and optional property) field in the sensor settings:

Value of InterestLineEntry in Sensor’s XML Node FieldProcessed Value
ack3ack2435
interval of deliver_details5deliver_details/interval5132000
messages of queue_totals8queue_totals/messages17014284
last_event of messages_details11queue_totals/
messages_details/last_event
1332263428950
first entry for ip_address of listeners12listeners[1]/ip_address0.0.0.0
second entry for ip_adress of listeners12listeners[2]/ip_address::

Because the node “listeners” in the example code is an array (as like “contexts”, identifiable by square brackets), you need to address the elements of “listeners” by their number of appearance. “1” addresses the first element of the array, “2” the second one, etc. After the array element address, define the item to be queried of the specific array element (preceded by a slash sign).

To query the value of a node containing more than one element, or to query a value that is deeper in the JSON tree, provide the whole path (like for “last_event” in the table with example queries). Considering the example code, there are many “rate” values under different nodes. Providing the whole path ensures you to get the right value.

Important notice: You will have to add one sensor for each single value you want to query. Each sensor will send requests to the server. Thus, if you monitor a JSON file with, for example, 30 single sensors, then there will be 30 requests to the HTTP server with each scanning interval.

Created on Feb 28, 2013 2:48:31 PM by  Gerald Schoch [Paessler Support]

Last change on Feb 28, 2013 4:11:55 PM by  Gerald Schoch [Paessler Support]




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.