New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


HTTP JSON/REST Sensor Feature Request

Votes:

0

Your Vote:

Up

Down

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 by  Frank Hughes (0) 1



6 Replies

Accepted Answer

Votes:

1

Your Vote:

Up

Down

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 [Paessler Support]

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



Votes:

0

Your Vote:

Up

Down

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":"[email protected]","statistics_db_node":"[email protected]","listeners":
[{"node":"[email protected]","protocol":"amqp","ip_address":"0.0.0.0","port":5672},{"node":"[email protected]","protocol":"amqp","ip_address":"::","port":5672}],"contexts":
[{"node":"[email protected]","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 by  Megamuch (60) 1 1

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



Votes:

0

Your Vote:

Up

Down

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 [Paessler Support]



Votes:

0

Your Vote:

Up

Down

@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 by  brandonw (0)



Votes:

0

Your Vote:

Up

Down

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 by  gcoutts (0)



Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.