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

Error when using setobjectproperty in API with Sensor Factory item

Votes:

0

Hi, I have a perl script that clones PRTG sensors using the web API, changing some parameters in the process. In the past this same script worked fine but after not using it for quite some time, it is now returning an unexpected error (several PRTG updates occurred in the interim). Suspecting a bug but maybe I'm missing something here. Script output is below, but basically this is the error, when I attempt to change the sensor's channel definitions:

<error>The validation of the data provided failed due to the following:<br/><ul><li>Error in channel &quot;Broadcast Out[]&quot; (7) : Unmatched ) found. (code: PE2011)</li></ul><br/>The object has not been changed.</error>
400 Bad Request at C:\Users\tstevens\Documents\bin\PRTG\clone-sensors.pl line 387.

In the output below you can see that there is NOT any unmatched parenthesis, neither in the plain text nor the URI encoded output (%29). Also, I see no documentation at all on this particular error (code: PE2011) so it's not very useful to print that...

Interestingly, if I go to the web interface and add an extraneous ) in the sensor channel definition and try to save, it basically prints this same error. So it seems like when calling the API, some extra ) is being incorrectly added. Am I missing something? Maybe another set of eyes will catch an error on my side but I am not seeing it... Let me know your thoughts.

Thanks, Tim

What's being shown in the script output below:

  • Creates a new factory sensor based on an existing ("known good" and works fine) sensor factory sensor
  • The "String" is the plain text channel definition to be pushed to the new cloned sensor
  • The "URI Escaped string" is exactly that (via uri_escape($newAggregationChannel))
  • the "Request sent to prtg" is the URL sent to PRTG (minus user/pass)
  • "Response from PRTG" is this funky error I keep getting!

C:\Users\tstevens\Documents\bin\PRTG>clone-sensors.pl Target device: tstevens-3548p-1.cisco.com (16486)

Creating new factory sensors...Created: e1/22 Traffic (16655)

String:

#1:Total Traffic
Channel(16547,8) + Channel(16547,13) + Channel(16547,9) + Channel(16547,14) + Channel(16547,10) + Channel(16547,15)
#2:Unicast In
Channel(16547,8)
#3:Unicast Out
Channel(16547,13)
#4:Multicast In
Channel(16547,9)
#5:Multicast Out
Channel(16547,14)
#6:Broadcast In
Channel(16547,10)
#7:Broadcast Out
Channel(16547,15)

URI Escaped string:

%231%3ATotal%20Traffic%0AChannel%2816547%2C8%29%20%2B%20Channel%2816547%2C13%29%20%2B%20Channel%2816547%2C9%29%20%2B%20Channel%2816547%2C14%29%20%2B%20Channel%2816547%2C10%29%20%2B%20Channel%2816547%2C15%29%0A%232%3AUnicast%20In%0AChannel%2816547%2C8%29%0A%233%3AUnicast%20Out%0AChannel%2816547%2C13%29%0A%234%3AMulticast%20In%0AChannel%2816547%2C9%29%0A%235%3AMulticast%20Out%0AChannel%2816547%2C14%29%0A%236%3ABroadcast%20In%0AChannel%2816547%2C10%29%0A%237%3ABroadcast%20Out%0D%0AChannel%2816547%2C15%29%0A%3C%2Fprtg%3E

Request sent to prtg:

https://tstevens-prtg.cisco.com/api/setobjectproperty.htm?id=16655&name=aggregationchannel&value=%231%3ATotal%20Traffic%0AChannel%2816547%2C8%29%20%2B%20Channel%2816547%2C13%29%20%2B%20Channel%2816547%2C9%29%20%2B%20Channel%2816547%2C14%29%20%2B%20Channel%2816547%2C10%29%20%2B%20Channel%2816547%2C15%29%0A%232%3AUnicast%20In%0AChannel%2816547%2C8%29%0A%233%3AUnicast%20Out%0AChannel%2816547%2C13%29%0A%234%3AMulticast%20In%0AChannel%2816547%2C9%29%0A%235%3AMulticast%20Out%0AChannel%2816547%2C14%29%0A%236%3ABroadcast%20In%0AChannel%2816547%2C10%29%0A%237%3ABroadcast%20Out%0D%0AChannel%2816547%2C15%29%0A%3C%2Fprtg%3E

Response from PRTG:

<?xml version="1.0" encoding="UTF-8" ?>
<prtg>
<version>16.4.27.6720</version>
<error>The validation of the data provided failed due to the following:<br/><ul><li>Error in channel &quot;Broadcast Out[]&quot; (7) : Unmatched ) found. (code: PE2011)</li></ul><br/>The object has not been changed.</error>
400 Bad Request at C:\Users\tstevens\Documents\bin\PRTG\clone-sensors.pl line 388.
</prtg>

api error-messages sensor-factory

Created on Apr 7, 2017 9:59:08 PM

Last change on Apr 10, 2017 8:42:55 AM by  Stephan Linke [Paessler Support]



2 Replies

Votes:

0

Hi Tim,

There's a <ptrg> at the end of your channel definition which does not belong there. Otherwise, the definition is correct and should work. Please try to get rid of the xml tag and see if works.

Created on Apr 10, 2017 8:43:43 AM by  Stephan Linke [Paessler Support]



Votes:

0

Thanks, ya, I figured that out eventually ;) Tim

Created on Apr 10, 2017 5:00:06 PM




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.