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)
Article Comments
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.
Jun, 2016 - Permalink
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.
Jun, 2016 - Permalink
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).
Jun, 2016 - Permalink
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.
Jun, 2016 - Permalink
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.
Jun, 2016 - Permalink
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"
Jun, 2016 - Permalink
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.
Jun, 2016 - Permalink
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
Oct, 2017 - Permalink
That is indeed the case - I'll share it with the colleagues. Thanks for the heads up! :)
Kind regards,
Stephan Linke, Tech Support Team
Oct, 2017 - Permalink
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.
Jun, 2016 - Permalink