<%NUMBERING1%>.<%NUMBERING2%>.<%NUMBERING3%> PRTG Manual: Monitoring via Push

PRTG provides the option to monitor passively received data. For this purpose, you can set up a device in a way that it automatically sends the data to PRTG. Specific sensor types can receive this data and alarm you based on your individual settings. For example, all Linux/Unix and most network devices support remote devices generating data, which has to be configured on each device, and sending the messages to a PRTG probe system. Usually, only the destination IP and port are required.

Push monitoring enables you to use webhooks to push messages to the PRTG server using Hypertext Transfer Protocol (HTTP). Wikipedia describes a webhook as a method of augmenting or altering the behavior of a web page or application with custom callbacks.

PRTG comes with built-in sensor types for push monitoring:

Use Cases

The push technology can be useful for monitoring in different cases, for example when target devices do not allow requests via the usual technologies. The following scenarios are good examples of where to use HTTP Push sensors.

  • Devices that cannot run a PRTG probe
  • Appliances that are not accessible via SSH or SNMP
  • Web servers that can run certain scripts or PHP periodically
  • Migrating a lot of EXE sensors into one EXE script that manages the HTTP Push sensors and sends data to them. Some coding is required, see this Knowledge Base article: How can I monitor SCVMM hosts and VMs with PRTG?
  • When monitoring Linux services, see this Knowledge Base article: How can I monitor and automatically restart a service on a Linux host?
  • If you need to push a lot of data into PRTG in short periods of time; the sensors have been tested with about 10,000 values pushed within one minute.

How to Use

Webhooks basically work like push messages. These are triggered by an event (for example, a new comment to a blog post) and send according information in real time to a specified URL. You can use this technology to push messages to the PRTG Probe, and monitor count and content with HTTP Push sensors. Because webhooks use HTTP, you can integrate them without having to add new infrastructure to your network.

Recommended Configuration

Follow the steps below for a sample configuration of the HTTP Push sensors.

  1. Add the sensors.
  2. Define the URLs.

Step 1: Add the HTTP Push Count, HTTP Push Data, and HTTP Push Data Advanced sensors to PRTG.

You can use the standard method to add sensors to your configuration.

  1. Choose the Probe Device or a device of your own.
    icon-i-roundA device of your own has no practical advantage with HTTP Push sensors but it might help you stay better organized.
  2. Click Add Sensor and filter for Push Message Receiver under Technology Used.
  3. Select one of the HTTP Push sensors that fits best to your intended usage.

icon-book-arrowsFor more details, see section Add a Sensor.

icon-i-round These sensor types cannot be used in cluster mode. You can set them up on local probes or remote probes only, not on cluster probes.

Step 2: Define the corresponding URL to send HTTP requests to PRTG.

In order for the desired configuration to be properly sent to and received by PRTG, please use the following URL formats.

The HTTP Push Count sensor uses the following URL:

http://<probe_ip>:<port_number>/<token>

Replace the parameters <probe_ip>, <port_number>, and <token> with the corresponding values.

  • The <probe_ip> is the IP address of the system where the PRTG probe with the sensor is running.
  • The <port_number> is where the sensor listens for incoming HTTP calls.
  • The <token> is used to define the matching sensor.

Example:

http://192.0.2.0:5050/XYZ123

icon-i-roundYou can use several sensors with the same port and identification token. In this case, the number of push messages will be shown in each of these sensors.

The HTTP Push Data sensor uses the following URL:

http://<probe_ip>:<port_number>/<token>?value=<integer_or_float>&text=<text message>

Replace the parameters <probe_ip>, <port_number>, <token>, and <integer_or_float> with the corresponding values. The &text parameter is optional: You can omit it.

  • You can define port number and identification token in the sensor settings.
  • The probe IP is the IP address of the system on which your PRTG probe with this sensor is running.
  • The value can be an integer or a float value, depending on the data of your application; you have to set the value type accordingly in the sensor settings. This parameter will be the sensor value.
    icon-i-blueIf this parameter is missing, the sensor will show a down status.
  • You can optionally add a custom text message by replacing the parameter <text message> with it. The text will be shown as sensor message. If there is no value but only a text, the text will be shown as error message.
    icon-i-blueThis text message has to be URL encoded (for example, the whitespaces in the sample URL below); most browsers achieve this automatically.

Example:

http://192.0.2.0:5050/XYZ123?value=0&text=this%20is%20a%20message

 
icon-i-roundYou can use several sensors with the same port and identification token. In this case, the data of push messages will be shown in each of these sensors.

The HTTP Push Data Advanced sensor uses the following URLs depending on the type of HTTP request.

  • GET requests: http://<probe_ip>:<port_number>/<token>?content=<valid XML_or_JSON>
     
    The XML encoded value of the content parameter has to match the format as defined in section Custom Sensors.
  • POST requests: http://<probe_ip>:<port_number>/<token>
     
    This HTTP request method sends the XML or JSON encoded HTTP body as POST data. The body has to match the format as defined in section Custom Sensors. We strongly recommend the HTTP content type application/xml or application/json.

Replace the parameters <probe_ip>, <port_number>, <token>, and <valid XML_or_JSON> (for GET requests) with the corresponding values:

  • You can define port number and identification token in the sensor settings.
  • The probe IP is the IP address of the system on which your PRTG probe with this sensor is running.
  • The content of GET requests has to be valid XML or JSON in the PRTG API format.
    icon-i-blueThe content has to be URL encoded (for example, the whitespaces in the sample URL below); most browsers achieve this automatically.

Minimum example for the GET method that returns one static channel value:

http://127.0.0.1:5050/XYZ123?content=<prtg><result><channel>MyChannel</channel><value>10</value></result><text>this%20is%20a%20message</text></prtg>

icon-i-blueBy default, values within the <value> tags in the returned XML or JSON must be integers to be processed. If float values are returned, you have to explicitly define this value type as defined in section Custom Sensors with <float> tags, otherwise the sensor will show 0 values in affected channels. Example:

http://127.0.0.1:5050/XYZ123?content=<prtg><result><channel>MyChannel</channel><value>10.45</value><float>1</float></result><text>this%20is%20a%20message</text></prtg>

icon-i-roundYou can use several sensors with the same port and identification token. In this case, the data of push messages will be shown in each of these sensors.

Conclusion

These sensor types are great tools to count and display HTTP push messages to the PRTG server and to keep you up-to-date with real-time information about your network.

More

Knowledge Base: How can I monitor SCVMM hosts and VMs with PRTG?

Knowledge Base: How can I monitor and automatically restart a service on a Linux host?

Keywords: