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 create a sensor to monitor the number of paused or unknown sensors?

Votes:

0

I had a situation recently where I had a large number of sensors enter a paused (or unknown) state and no one was informed of the situation. I was wondering if there was a way to create a sensor that would notify the PRTG system admin if the number of Down, Paused, Unknown sensors reached a specific threshold.

Basically a warning when too many errors are detected.

paused prtg-network-monitor reporting senors

Created on Mar 18, 2010 2:53:22 PM

Last change on Jan 4, 2023 9:42:38 AM by  Brandy Greger [Paessler Support]



Best Answer

Accepted Answer

Votes:

1

This article applies as of PRTG 22

Monitoring sensors with a specific status via the REST Custom sensor

To monitor the number of sensors in a specific status, for example Paused or Unknown sensors, add a REST Custom sensor to your PRTG installation.

PRTG comes with a REST configuration template. This template retrieves a .json file via the PRTG API and parses it. The .json file contains the current number of all sensor states. Additionally, you can define sensor limits depending on your needs. Set up the sensor as follows:

Sensor setup

  • Add a REST Custom sensor to your PRTG installation. Since we want to monitor PRTG itself, it makes sense to add the sensor to the probe device of the local probe (127.0.0.1).
  • In the Add Sensor dialog, make sure to set the Request Protocol to the protocol you use to access PRTG (HTTP or HTTPS).
  • Under Certificate Acceptance, select Accept all certificates.
  • Provide the following URL in the REST Query:
/api/table.json?id=1&content=sensorxref&noraw=1&filter_basetype=probe&columns=totalsens=textraw,upsens=textraw,downsens=textraw,partialdownsens=textraw,warnsens=textraw,pausedsens=textraw,unusualsens=textraw,undefinedsens=textraw,downacksens=textraw&username=<USERNAME>&passhash=<PASSHASH>

Note: You need to replace the <USERNAME> and <PASSHASH> in the URL above with your own credentials for authentication. You can find the passhash under Setup | Account Settings | My Account | Passhash.

  • Under REST Configuration, select prtg-sensor-stats.template.
  • Leave all other settings unchanged.
  • Click Create to create the sensor.
  • Define limits for warnings and alarms in the sensor’s channel settings.

This sensor now monitors the number of sensors in the defined status and shows the Warning or Down status depending on the defined limits.

More

Created on Jun 21, 2018 11:02:19 AM by  Brandy Greger [Paessler Support]

Last change on Jan 2, 2023 2:38:46 PM by  Brandy Greger [Paessler Support]



5 Replies

Votes:

0

Create a Custom Sensor using the API

Using the API it is possible to create a custom sensor that provides you with this information.

But what if this sensor suddenly goes into a warning state?

Created on Mar 19, 2010 8:12:21 AM



Votes:

2

Alternative Approach to the "Best Answer"

I would suggest to use customized web page template for the PRTG webserver, that displays the number of sensors in paused/warning/OK etc. status, plus a HTTP content sensor, that monitors this value.

Step 1: Creating your own API function

  • Create a new textfile "getsensorsbystate.htm" in the \website\api folder of your PRTG installation. Note: As of PRTG Network Monitor 13.2.3, the folder is \webroot\api. See this article for details.
  • Edit the file in a text editor, paste the following code, and save the file:
[<#graph graphcontent="statusoverview" show="textraw">]

Step 2: Creating a HTTP Content sensor to monitor the value

Create a new HTTP Content sensor and enter the following URL:

http://yourprtgserver.ip/api/getsensorsbystate.htm?name=downsens&username=xyz&password=abc

This URL will display the total number of sensors which are in Error state (red), shown as a number between brackets [].

[8]

Please note: If there is no sensor in error state, the brackets will only contain a whitespace:

[ ]

The HTTP Content sensor reads this information and uses it as sensor values. Now your can use limits and triggers to send notifications.

The possible values for the "name" parameter are:

NameDescription
upsensUp sensors
downsensDown sensors
downacksensAcknowledged Down alarms
warnsensWarning sensors
unusualsensUnusual sensors
pausedsensPaused sensors
undefinedsensUnknown sensors
totalsensTotal sensors

You can only request one value per request/sensor. So in order to monitor unknown and error sensors you need to set up two HTTP Content sensors.

Please have a look at the API documentation for more information about using the HTTP API: How can I use the PRTG application programming interface (API)?

Created on Mar 19, 2010 12:13:40 PM by  Dirk Paessler [Founder Paessler AG] (11,025) 3 6

Last change on Jun 26, 2013 12:01:57 PM by  Gerald Schoch [Paessler Support]



Votes:

1

New Custom Sensor Available

What you basically want to do, is present a counter like the Gadget does. This routine is now implemented in a new Custom Sensor: SensorCount.

It requires the following parameters to query your PRTG server:

-s=ip-address[:portnumber] -u=username -p=password

Using (a combination of) the following switches you can count the sensors of your choice.

-u    count up sensors
-d    count down sensors
-a    count acknowledged down sensors
-w    count warning sensors
-u    count unusual sensors
-p    count paused sensors
-k    count unknown sensors

So in order to monitor unknown and error sensors you simply supply the -k and the -d switch.

Created on Mar 24, 2010 7:10:33 PM

Last change on Aug 10, 2016 11:43:28 AM by  Erhard Mikulik [Paessler Support]



Votes:

1

This article applies to PRTG Network Monitor 13.2 or later

Monitoring the Number of Sensors in a Specific Status

In order to monitor the number of sensors in a specific status, for example, paused or unknown sensors count, add an HTTP XML/REST Value Sensor to your PRTG installation.

Set up the sensor as indicated below. This approach will retrieve an XML file via PRTG API containing the current number of all sensor states and parses it. Provide the XML node denoting the sensor status you are interested in and define sensor limits depending on your needs.

Steps to Go

1. Add an HTTP XML/REST Value sensor to your PRTG installation.

2. In the sensor settings, provide the following URL:

http://yourprtgserver/api/gettreenodestats.xml

Note: You'll need to add the username and passhash/password of your PRTG server to the URL in order to authenticate, as per the example below:

/api/gettreenodestats.xml?username=myusername&passhash=hash

For details, please refer to PRTG Manual: HTTP API

3. Enter the XML node denoting the sensor status you are interested in. In order to monitor the number of paused sensors, use the parameter pausedsens. See below for other possible values.

4. You can leave all other settings unchanged.

5. Click Continue to create the sensor.

6. Define limits for warnings and alarms in the sensor’s channel settings.

You can use the following parameters for the XML node:

XML NodeDescription
upsensUp sensors
downsensDown sensors
downacksensAcknowledged Down alarms
warnsensWarning sensors
unusualsensUnusual sensors
pausedsensPaused sensors
undefinedsensUnknown sensors
totalsensTotal sensors

This sensor monitors now the number of sensors in the defined status and goes into warning or alarm status depending on the defined limits.

Created on Jun 26, 2013 11:56:13 AM by  Gerald Schoch [Paessler Support]

Last change on Aug 14, 2018 8:48:46 AM by  Brandy Greger [Paessler Support]



Accepted Answer

Votes:

1

This article applies as of PRTG 22

Monitoring sensors with a specific status via the REST Custom sensor

To monitor the number of sensors in a specific status, for example Paused or Unknown sensors, add a REST Custom sensor to your PRTG installation.

PRTG comes with a REST configuration template. This template retrieves a .json file via the PRTG API and parses it. The .json file contains the current number of all sensor states. Additionally, you can define sensor limits depending on your needs. Set up the sensor as follows:

Sensor setup

  • Add a REST Custom sensor to your PRTG installation. Since we want to monitor PRTG itself, it makes sense to add the sensor to the probe device of the local probe (127.0.0.1).
  • In the Add Sensor dialog, make sure to set the Request Protocol to the protocol you use to access PRTG (HTTP or HTTPS).
  • Under Certificate Acceptance, select Accept all certificates.
  • Provide the following URL in the REST Query:
/api/table.json?id=1&content=sensorxref&noraw=1&filter_basetype=probe&columns=totalsens=textraw,upsens=textraw,downsens=textraw,partialdownsens=textraw,warnsens=textraw,pausedsens=textraw,unusualsens=textraw,undefinedsens=textraw,downacksens=textraw&username=<USERNAME>&passhash=<PASSHASH>

Note: You need to replace the <USERNAME> and <PASSHASH> in the URL above with your own credentials for authentication. You can find the passhash under Setup | Account Settings | My Account | Passhash.

  • Under REST Configuration, select prtg-sensor-stats.template.
  • Leave all other settings unchanged.
  • Click Create to create the sensor.
  • Define limits for warnings and alarms in the sensor’s channel settings.

This sensor now monitors the number of sensors in the defined status and shows the Warning or Down status depending on the defined limits.

More

Created on Jun 21, 2018 11:02:19 AM by  Brandy Greger [Paessler Support]

Last change on Jan 2, 2023 2:38:46 PM by  Brandy Greger [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.