New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Create sensors dynamically

Votes:

0

Your Vote:

Up

Down

Hello, we have several situations where we use Powershell to read values. At the moment we put the results in 1 sensor with several channels, but somtimes they exceed the 50 max channels. We would like to have a script or sensor, that can put the results in new sensors instead of in a channel.

Let me explain. We have several DHCP servers with multiple scopes. I can read the scopes and the values into channels, so i get 1 sensor, with: 1) the scope (127.0.0.0) 2) number of free IP's 3) number of used IP's 4) percent used of IP's 1) the scope (192.168.178.0) 2) number of free IP's 3) number of used IP's 4) percent used of IP's etc etc etc

And since we have more then 50 scopes (x 4 channels) it is not visible anymore in a list. And if we want to remove 1 scope, we have to remove the whole sensor so we loose the history of the other scopes.

What we would like to have is 1 script/sensor that gets all the scopes and info together. Then split this into parts (1 scope, number of free IP's, number used IP's and percent used IP's) per scope. Then make a sensor for every scope with the 4 info parts as channel info. In that case we can remove 1 scope from the DHCP server and the other scopes would still exist. new scopes would be added automatically and we could remove the scopes and sensors by hand.

I know i have seen something like this, but i cannot find it anymore (not on Google and not here)

We also have several other scripts which we would like to transfer to something like the above (like disk info from a NAS from 600 disks, VM info from all VMware and HyperV hosts etc)

custom powershell prtg script sensor

Created on May 31, 2016 11:14:17 AM by  Gemeente Enschede (190) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Sounds like you really need to automate adding devices and sensors...

Have a look at the powershell modeule I have, it lets you bulk clone and change settings. https://thedomainiown.wordpress.com/prtg-related/prtg-script-powershell-admin-module/

For only 50 scopes, I would setup 50 devices (manually, via cloning). But it sounds like you have lots of other uses for programatically adding objects.

Created on Jun 5, 2016 12:46:33 PM by  AndrewG (1,783) 2 2



10 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

Unfortunately to automatically create a new sensor if the channel limit of 50 is reached is not possible, sorry. Our recommendation here is to create for each scope a sensor to avoid the channel limit and keep the historic data.

Created on Jun 2, 2016 1:26:25 PM by  Jochen Greger [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Yes, i understand that. In my example of what i want, it is indeed that every scope is a sensor with a few channels.

But the problem is that i want to make the sensors automatically. And NOT make every scope by hand.

I now have something that can make channels automatically, but i want a sensor made automatically for every scope 1 sensor.

Created on Jun 2, 2016 2:28:03 PM by  Gemeente Enschede (190) 1



Votes:

0

Your Vote:

Up

Down

Unfortunately to automatically create new sensors is not possible but you can clone sensors. You could create a sensor just for this purpose. The documentation can be found directly in PRTG, menu Setup / PRTG API, tab "Object Manipulation". However, not all sensor settings are documented. While not officially supported by us, you could have a look what the webinterface does and use those HTTP actions to derive the API call which does the same.

Another option to change sensor settings is the manual editing of the "PRTG Configuration.dat", which however is also not covered by our support.

Created on Jun 2, 2016 5:58:22 PM by  Jochen Greger [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I really thought i had seen a post here (or somewhere on the internet) that someone had a way in Powershell to create a new sensor and give it the right values in the same Powershell script.

But i think i will have to try and make this in Powershell with the http api then.

It would be en nice feature though if you could make a new sensor based on information from a script (powershell in my case) that runs as custom sensor.

Thanks for the help (still hope someone knows that link i saw some time ago).

Created on Jun 3, 2016 6:27:01 AM by  Gemeente Enschede (190) 1



Votes:

0

Your Vote:

Up

Down

I suddenly think of something. I could use the factory sensor, but then i need the ID of all the channels so i can read the info from a powershell script.

Since making sensors does not work i would like to know, how i can 'read' the ID of a channel in a specific sensor. If i can do that, then i can use my own script with 'too much' channels and rearrange that into smaller sensors via the HTTP Api as you suggested.

Created on Jun 3, 2016 7:03:42 AM by  Gemeente Enschede (190) 1



Accepted Answer

Votes:

0

Your Vote:

Up

Down

Sounds like you really need to automate adding devices and sensors...

Have a look at the powershell modeule I have, it lets you bulk clone and change settings. https://thedomainiown.wordpress.com/prtg-related/prtg-script-powershell-admin-module/

For only 50 scopes, I would setup 50 devices (manually, via cloning). But it sounds like you have lots of other uses for programatically adding objects.

Created on Jun 5, 2016 12:46:33 PM by  AndrewG (1,783) 2 2



Votes:

0

Your Vote:

Up

Down

Unfortunately at the moment it is technically not possible to create sensors by api, only clone existing sensors. The API call to retrieve the channel names ind id´s of a sensor is: /api/table.xml?content=channels&output=xml&columns=name_&id="SENSORID"

Created on Jun 6, 2016 5:49:05 AM by  Jochen Greger [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

We really could use the possibility to add sensors to devices by script. Please add this in the future.

@AndrewG: Thanks, that was indeed what i had seen earlier, but could not find again. We do have more then 70 scopes in 1 environment (the biggest we have), but since we have more environments....... I think i would go for setting up 1 device (a server) and then add the scopes as sensors and after that make the channels in the scopes with the right data.

I will take a good look at this after my vacation. Thanks for the help.

Created on Jun 6, 2016 6:41:00 AM by  Gemeente Enschede (190) 1



Votes:

0

Your Vote:

Up

Down

sorry for reply many (many) years later but found a really top solution for this:

https://github.com/lordmilko/PrtgAPI

very impressive fully-featured c#/powershell API for PRTG wow

Created on Oct 20, 2017 9:33:48 AM by  trunq (11) 1



Votes:

0

Your Vote:

Up

Down

That is indeed the case - I'll share it with the colleagues. Thanks for the heads up! :)


Kind regards,
Stephan Linke, Tech Support Team

Created on Oct 20, 2017 9:57:06 AM by  Stephan Linke [Paessler Support]



Please log in or register to enter your reply.


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.