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

Check new sensor paused or inactive

Votes:

0

This is a question about creating sensors via the API. After cloning a Http Push Advanced sensor it is paused, so we then un-pause the sensor. The sensor is inactive for a time, so we poll the server until 'Matching Sensors=1', indicating the sensor is active and ready to receive data.

Sometimes, however, the newly created sensor is paused (probably the unpause command failed) and therefore the process fails.

The problem is that between the time the sensor is unpaused (which happens immediately after cloning) and the time the sensor becomes active (which is about 45 seconds) the code currently cannot tell whether the sensor is unpaused & inactive, or paused & inactive.

How can we check via the API if a newly cloned sensor that isn't yet active has successfully been unpaused? I.e. is there a status available via API for sensors that will indicate each of active status and paused status?

Hope all this makes sense, Paul

clone inactive paused sensor

Created on Sep 8, 2016 10:42:22 AM



3 Replies

Votes:

0

Dear Paul

Which API call are you using to extract the sensor status? In principle, you can detect the current status:

status 7 = Paused by user (automatically set for clones.)
status 3 = Up
status 4 = Warning
status 5 = Down
status 1 = Unknown (sensor was resumed but has no data yet.)

However, the unpause command should not fail. Can you reproduce that or tie it to a general PRTG overload? Would it be an option to send the unpause API call several times?

Created on Sep 8, 2016 4:28:34 PM by  Arne Seifert [Paessler Support]



Votes:

0

The only check we perform is to see whether the sensor is ready for accepting data:

http://prtghost:5050/sensor_token_string The response is json:

{
  "status": "Ok",
  "Matching Sensors": "0"
}

We keep polling the server with this request until "Matching Sensors" = "1"

What is the API call to get status code?

As for reproducing, we will do some more testing and let you know if it is reproducible or maybe just a developer machine glitch.

Paul.

Created on Sep 8, 2016 9:19:47 PM



Votes:

0

Dear Paul

This method you are using provides the readable sensor status. It is also possible to get the raw status code. For an example sensor ID 2123, the core API call looks like

/api/getsensordetails.json?id=2123

The property "statusid" contains the aforementioned numeric status code.

Created on Sep 9, 2016 11:50:19 AM by  Arne Seifert [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.