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

API Sensor modify channels settings

Votes:

0

Hi,

I would like modify channels settings after cloned a combined sensor by API.

For exemple I have this parameters on the initial sensor in the 'Channel definition' part :

  1. 2:Trafic entrant Channel(6456,0)+Channel(6458,0)
  2. 3:Trafic sortant Channel(6456,1)+Channel(6458,1)
  3. 4:Debit maximum [Kbit/s] 20000
  4. 1:Trafic entrant (canal principal) Channel(6456,0)+Channel(6458,0)
  5. 5:Utilisation trafic entrant percent(Channel(6456,0)+Channel(6458,0),20000,kilobit)
  6. 6:Utilisation trafic sortant percent(Channel(6456,1)+Channel(6458,1),20000,kilobit)

And i would like modify id of sensor (ex : 6456 to 7099) and the speed (ex : 20000 to 10000)

Its possible, what is the request ?

Thanks for your help! Thibaut.

api channel-settings prtg sensor

Created on Sep 16, 2020 9:22:40 AM



Best Answer

Accepted Answer

Votes:

1

The following demonstrates the API request you would use to set the channel definition

#1:Channel
channel(2059,0)

on the object with ID 1001

http://prtg.example.com/editsettings?id=1001&aggregationchannel_=%231%3AChannel%0Achannel(2059%2C0)&username=prtgadmin&passhash=12345678

Created on Sep 16, 2020 1:01:45 PM



8 Replies

Votes:

0

Sorry to formating, i can't edit previous post :

parameters on the initial sensor in the 'Channel definition' part :

#2:Trafic entrant 
Channel(6456,0)+Channel(6458,0)
#3:Trafic sortant 
Channel(6456,1)+Channel(6458,1)
4:Debit maximum [Kbit/s] 
20000
#1:Trafic entrant (canal principal) 
Channel(6456,0)+Channel(6458,0)
#5:Utilisation trafic entrant percent
(Channel(6456,0)+Channel(6458,0),20000,kilobit)
#6:Utilisation trafic sortant percent
(Channel(6456,1)+Channel(6458,1),20000,kilobit)

Created on Sep 16, 2020 11:24:39 AM



Votes:

0

Hello,

Thank you for your message.

To modify the channel definition of the Sensor Factory sensor, I invite you to take a look at the PowerShell module called PRTGAPI.

With this module, you are able to get the properties of a sensor by using the command Get-Sensor -id {id} | Get-ObjectProperty.

Therefore you can get the channel definition of the SF sensor by using the command above, replace the values you want and then, use the command Set-ObjectProperty to apply the modification.

The commands are described in the wiki of the PowerShell module whose GitHub page is here: https://github.com/lordmilko/PrtgAPI

There is also a wiki which is very well documented: https://github.com/lordmilko/PrtgAPI/wiki

Kind regards.

Created on Sep 16, 2020 11:29:37 AM by  Florian Lesage [Paessler Support]



Votes:

0

Thanks for your answer.

my script is based on Python. What is the API call url if existing ?

Created on Sep 16, 2020 11:35:27 AM



Votes:

0

Hi Th1b0plz,

In addition to the above, I would recommend you check out the Sensor Factories page, which not only includes an example of how you would modify a sensor factory channel definition using Set-ObjectProperty, but also how you can dynamically generate complex sensor factory definitions based on a collection of sensors. This may be useful for automatically updating your channel definitions based on changing requirements going forward.

If you wish to utilize the raw HTTP API to perform this instead, you can view the API request that PrtgAPI generates by specifying the -Verbose parameter to Set-ObjectProperty. Note however that given the complex URL encoding involved doing it manually with the raw API may not be desirable.

Regards,

lordmilko

Created on Sep 16, 2020 12:38:03 PM



Accepted Answer

Votes:

1

The following demonstrates the API request you would use to set the channel definition

#1:Channel
channel(2059,0)

on the object with ID 1001

http://prtg.example.com/editsettings?id=1001&aggregationchannel_=%231%3AChannel%0Achannel(2059%2C0)&username=prtgadmin&passhash=12345678

Created on Sep 16, 2020 1:01:45 PM



Votes:

0

Its works perfectly !

just in python must add a '%' before another '%' else python is interpreting the % as a printf-like format character

Thanks you very much !

Edit : i'm stupid sorry.. i guess it must just write all settings in the same url

Created on Sep 16, 2020 3:42:16 PM

Last change on Sep 18, 2020 9:50:13 AM by  Florian Lesage [Paessler Support]



Votes:

0

Hello,

I've an annoter question about this subject

And how can i just add settings at the existant ? Because this API call works fin to write a channel settings but it erase existants

Created on Sep 18, 2020 8:57:48 AM



Votes:

0

Hi Th1b0plz,

I'm not too sure I understand what you're asking, but in order to update the sensor factory channel definition you need to rewrite the entire definition. As such, if you want to make any changes to it, you need to request the entire definition from PRTG, make your changes to it, and then reapply the updated definition to PRTG

Created on Sep 18, 2020 9:37:09 AM




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.