PRTG Manual: REST JSON Data Sensor

The REST JSON Data sensor accesses a Representational State Transfer (REST) application programming interface (API) endpoint and retrieves JavaScript Object Notation (JSON) encoded data.

i_betaThis sensor is in beta status. The operating methods and the available settings are still subject to change. Do not expect that all functions work properly, or that this sensor works as expected at all.

s_rest_json_data_zoom50

i_square_cyanFor a detailed list and descriptions of the channels that this sensor can show, see section Channel List.

Sensor in Other Languages

  • Dutch: REST JSON Data
  • French: REST JSON Data
  • German: REST JSON Data
  • Japanese: REST JSON Data
  • Portuguese: REST JSON Data
  • Russian: REST JSON Data
  • Simplified Chinese: REST JSON Data
  • Spanish: REST JSON Data

Remarks

Consider the following remarks and requirements for this sensor:

Requirement

Description

Enabled Beta Sensors experimental feature

This sensor requires that the Beta Sensors experimental feature is enabled.

i_square_cyanFor more information, see the Knowledge Base: What are beta sensors and how can I use them?

Credentials

This sensor requires credentials for REST API in settings that are higher in the object hierarchy.

JSON Schema

For more information about the JSON schema that this sensor uses, see the Knowledge Base: Where can I find the JSON schema against which a sensor validates my script output?

IPv6

This sensor supports IPv6.

Smart URL replacement

This sensor supports smart URL replacement.

Channels

This sensor does not officially support more than 50 channels.

Performance impact

This sensor has a very low performance impact.

Lookups

This sensor uses lookups to determine the status values of one or more channels.

Scanning interval

This sensor has a fixed minimum scanning interval for performance reasons. You cannot use a shorter scanning interval. Consequently, shorter scanning intervals in the Monitoring settings are not available for this sensor.

  • The minimum scanning interval of this sensor is 1 minute.
  • The minimum scanning interval of this sensor is 5 minutes.

Multi-platform probe

You can add this sensor to a multi-platform probe.

Basic Sensor Settings

Basic Sensor Settings

Basic Sensor Settings

The sensor has the following default tags that are automatically predefined in the sensor's settings when you add the sensor:

  • rest

i_square_cyanFor more information about basic sensor settings, see section Sensor Settings.

Specific Sensor Settings

ss_rest_json_data_zoom90

Setting

Description

Request URL

Enter the URL that you want to request. This setting supports smart URL replacement. If you enter http:///, PRTG automatically fills in the IP address or DNS name of the parent device. The default URL is https://%host/.

i_round_blueYou can use the following placeholders in this field: %host, %restusername, %restpassword, %restbearertoken, %restplaceholder1, %restplaceholder2, %restplaceholder3, %restplaceholder4, and %restplaceholder5. You can define these placeholders in the credentials for REST API in settings that are higher in the object hierarchy.

i_square_cyanPRTG uses a smart URL replacement with which you can use the parent device's IP address or Domain Name System (DNS) name setting as part of the URL. For more information, see section Smart URL Replacement.

Request Method

Select the HTTP request method that the sensor uses to request the REST API:

  • GET (default): Use the GET method to request the REST API.
  • POST: Use the POST method to request the REST API.

POST Body

This setting is only visible if you select POST above.

Enter the data part for the POST request.

i_round_blueYou can use the following placeholders in this field: %host, %restusername, %restpassword, %restbearertoken, %restplaceholder1, %restplaceholder2, %restplaceholder3, %restplaceholder4, and %restplaceholder5. You can define these placeholders in the credentials for REST API in settings that are higher in the object hierarchy.

Custom HTTP Headers

Enter custom HTTP headers that the REST API request of the sensor contains. Each line must contain a valid HTTP header like key:value.

i_round_blueYou can use the following placeholders in this field: %host, %restusername, %restpassword, %restbearertoken, %restplaceholder1, %restplaceholder2, %restplaceholder3, %restplaceholder4, and %restplaceholder5. You can define these placeholders in the credentials for REST API in settings that are higher in the object hierarchy.

Timeout (Sec.)

Enter a timeout in seconds for the request. Enter an integer. The maximum timeout value is 900 seconds (15 minutes).

i_round_blueIf the reply takes longer than this value, the sensor cancels the request and shows a corresponding error message.

Sensor Display

Sensor Display

Sensor Display

Setting

Description

Primary Channel

Select a channel from the list to define it as the primary channel. In the device tree, PRTG displays the last value of the primary channel below the sensor's name. The available options depend on what channels are available for this sensor.

i_round_blueYou can set a different primary channel later by clicking b_channel_primary below a channel gauge on the sensor's Overview tab.

Graph Type

Define how this sensor shows different channels:

  • Show channels independently (default): Show a graph for each channel.
  • Stack channels on top of each other: Stack channels on top of each other to create a multi-channel graph. This generates a graph that visualizes the different components of your total traffic.
    i_round_redYou cannot use this option in combination with manual Vertical Axis Scaling (available in the channel settings).

Stack Unit

This setting is only visible if you select Stack channels on top of each other above.

Select a unit from the list. PRTG stacks all channels with this unit on top of each other. By default, you cannot exclude single channels from stacking if they use the selected unit. However, there is an advanced procedure to do so.

Debug Options

Debug Options

Debug Options

Setting

Description

Result Handling

Define what PRTG does with the sensor result:

  • Discard result (default): Do not store the sensor result.
  • Store result: Store the sensor result and the last response in the \Logs\sensors subfolder of the PRTG data directory on the probe system. The file name is Result of Sensor [ID].log. This setting is for debugging purposes. PRTG overwrites this file with each scanning interval.

i_podThis option is not available when the sensor runs on the hosted probe of a PRTG Hosted Monitor instance.

i_round_blueIn a cluster, PRTG stores the result in the PRTG data directory of the master node.

Inherited Settings

By default, all of these settings are inherited from objects that are higher in the hierarchy. We recommend that you change them centrally in the root group settings if necessary. To change a setting for this object only, click b_inherited_enabled under the corresponding setting name to disable the inheritance and to display its options.

i_square_cyanFor more information, see section Inheritance of Settings.

Smart URL Replacement

  • Instead of entering a complete address in the Request URL  corresponding field of the sensor, you can also enter the protocol followed by a colon and three forward slashes (this means that you can enter either http:/// or https:///, or even a simple forward slash / as the equivalent for http:///). PRTG automatically fills in the parent device's IP Address/DNS Name in front of the third forward slash.
  • Whether this results in a valid URL or not depends on the IP address or Domain Name System (DNS) name of the parent device. In combination with cloning devices, you can use smart URL replacement to create many similar devices.
     
    For example, if you create a device with the DNS name www.example.com and you add the sensor to it, you can provide values in the following ways:
  • If you enter https:/// in the Request URL field, PRTG automatically creates the URL https://www.example.com/.
  • If you enter /help in the Request URL field, PRTG automatically creates the URL https://www.example.com/help.
  • It is also possible to provide a port number in the Request URL field. It is taken over by the device's DNS name and is internally added, for example, https://:1616/.

i_round_redSmart URL replacement does not work for sensors that run on the probe device.

Channel List

i_round_blueWhich channels the sensor actually shows might depend on the target device, the available components, and the sensor setup.

Channel

Description

Downtime

In the channel table on the Overview tab, this channel never shows any values. PRTG uses this channel in graphs and reports to show the amount of time in which the sensor was in the Down status.

HTTP Status

The HTTP status that the requested URL returns

  • Up status: Accepted, Already Reported, Continue, Created, IM Used, Multi-Status, No Content, Non-Authoritative Information, OK, Partial Content, Processing, Reset Content, Switching Protocols
  • Warning status: Found, Moved Permanently, Multiple Choices, Not Modified, Permanent Redirect, See Other, Switch Proxy (deprecated), Temporary Redirect, Use Proxy
  • Down status: Bad Gateway, Bad Request, Bandwidth Limit Exceeded, Conflict, Expectation Failed, Failed Dependency, Forbidden, Gateway Time-out, Gone, HTTP Version not supported, I'm a teapot, Insufficient Storage, Internal Server Error, Length Required, Locked, Loop Detected, Method Not Allowed, No Response, Not Acceptable, Not Extended, Not Found, Not Implemented, Payment Required, Policy Not Fulfilled, Precondition Failed, Precondition Required, Proxy Authentication Required, Request Entity Too Large, Request Header Fields Too Large, Request Time-out, Request URL Too Long, Requested Range Not Satisfiable, Service Unavailable, The request should be retried after doing the appropriate action, There are too many connections from your internet address, Too Many Requests, Unauthorized, Unavailable For Legal Reasons, Unordered Collection, Unprocessable Entity, Unsupported Media Type, Upgrade Required, Variant Also Negotiates[13]
  • Unknown status: Unknown

i_round_blueThis channel is the primary channel by default.

Status

The status of the given endpoint

  • Up status: OK
  • Warning status: Warning
  • Down status: Error
  • Unknown status: Unknown

[Value]

The values that a REST API returns in several channels

More

i_square_blueKNOWLEDGE BASE

What are beta sensors and how can I use them?

What security features does PRTG include?

Where can I find the JSON schema against which a sensor validates my script output?