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

Sensor inactive after clone via API

Votes:

0

Hi there.

I'm trying to clone a HTTP Push Advanced sensor via API then push to it.

(note: username and password url parameters have been removed)

This is the clone via API:

/api/duplicateobject.htm?id=2094&name=new_sensor_name&targetid=2080

After clone I change sensor token:

/api/setobjectproperty.htm?id=2106&name=httppushtoken&value=new_token

Then resume (un-pause):

/api/pause.htm?id=2106&action=1

When I then attempt to push data to this sensor I receive:

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

I have noticed in my testing that if I wait for a few minutes then re-issue the push request it then succeeds. But waiting a few minutes in my code is undesirable.

What else do I need to do via API so that my new sensor can receive push?

clone http-advanced-sensor httppush

Created on Aug 23, 2016 2:15:40 AM



8 Replies

Votes:

0

You don't need to wait a few minutes, a few seconds (5-10) should be sufficient for the port listener to come up.

Created on Aug 23, 2016 5:51:40 AM by  Stephan Linke [Paessler Support]



Votes:

0

I tried adding a sleep of 10s to my code after cloning the sensor but it did not resolve the issue - I still get Matching Sensors = 0 on that immediate push after creating the sensor.

I then increased the sleep time and eventually at 60s sleep after creating a sensor did I get successful data push. This does seem like an awfully long pause to put in my code!

Is there any way to trigger / force the port listener to come up?

If not, can you recommend and API method to poll the server to check the sensor listener is up? Ideally without pushing dummy data.

In case it's helpful, we are using version 16.2.23.3171

Created on Aug 23, 2016 6:20:18 AM



Votes:

0

Is your sensor actually resumed? You can check the availability like this, in Powershell:
http://pastebin.com/raw/WwUhrGLP

If it works, the output will look something like this:

Name                           Value                                                                                                                                                           
----                           -----                                                                                                                                                           
ReponseCode                    OK                                                                                                                                                              
ResponseUri                    <your-url>:5050/A442C3E9-7C86-4F18-8CA4-A565AE4EB2C2                                                                                          
NewSensorID                    -1 

If anything goes wrong:

[23.08.2016 10:12:37]      error      URL could not be called. Error: System.Net.WebException
[23.08.2016 10:12:37]      notes      The connection with the remote host could not be established.

Hope that it's somewhat helpful :)

Created on Aug 23, 2016 8:16:16 AM by  Stephan Linke [Paessler Support]



Votes:

0

Yes - sensor is definitely resumed. I have implemented polling every 3 seconds and after about 45s the sensor becomes active and then my code successfully pushes the first data set. If there's any better way to do this I'd be grateful to hear from you. Thanks for your help to date.

Created on Aug 25, 2016 12:33:33 AM



Votes:

0

You could try installing the latest version of PRTG, where it hopefully works faster :)

Created on Aug 25, 2016 6:34:10 AM by  Stephan Linke [Paessler Support]



Votes:

0

We now have the latest version installed but no change to our issue. After cloning and un-pause, the code attempts to send the first push repeatedly (every 6 seconds) until the response comes back with "Matching Sensors = 1". This consistently takes about 45s each time I run this test.

If I run your powershell script during the 45s I get a successful response so the sensor is alive. But it just isn't able to receive the first push until 45s later.

It appears that I can create a clone via the web UI and it is ready to accept data in less than 45s (maybe even immediately). So there must be a way to fix this.

Created on Sep 21, 2016 2:06:57 AM



Votes:

0

We'll continue in the ticket and post the solution once we found one.

Created on Sep 21, 2016 10:15:00 AM by  Stephan Linke [Paessler Support]



Votes:

0

Turns out that after a bit of fiddling, an initial scan of the sensor via /api/scannow.htm?id={new-id} after the sensor being resumed solves the problem:

[22.09.2016 09:23:56]   information   Starting sensor creation for Testing (GUID: 2f4826a3-4cd5-40c5-97c2-f4ad13c8264a)
[22.09.2016 09:23:57]     success     Sensor created successfully. New sensor ID: 8205
[22.09.2016 09:23:57]     success     Sensor has been resumed.
[22.09.2016 09:23:58]     success     Sensor is now accepting data (0.57s)
[22.09.2016 09:23:58]   information   Starting sensor creation for Testing (GUID: 83b3a639-2a40-49e4-b5d7-be253055b6aa)
[22.09.2016 09:23:58]     success     Sensor created successfully. New sensor ID: 8206
[22.09.2016 09:23:58]     success     Sensor has been resumed.
[22.09.2016 09:24:00]     success     Sensor is now accepting data (0.731s)

Created on Sep 22, 2016 7:29:33 AM by  Stephan Linke [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.