TECHZEN Zenoss User Community ARCHIVE  

API to get the list of devices handled by a collector

Subject: API to get the list of devices handled by a collector
Author: Sam Urai
Posted: 2019-10-28 22:29

Hello,

Is there any api way to get the list of devices handled by a collector?

I would like to change the collector of the devices returned in the list to a new one using an api. Is it possible?

Will the api also move the performance data to  the new collector?

Thanks

------------------------------
Sam
------------------------------


Subject: RE: API to get the list of devices handled by a collector
Author: Adrian Vergara
Posted: 2019-10-29 15:10

Hello Sam, there's probably a few ways to go about it, from my experience, I would check the 'getDevice' method in the DeviceRouter class from the JSON API which will return a dictionary with the devices properties where you can find a key:value pair containing the collector information for each device found.

So for example, you could send the call requesting devices from the "Devices" device class (root class), set a high 'limit' parameter to make sure you'll scan all devices in case you have a big deployment (not the prettiest way to do it, you could first make a call to get the actual number of devices and then use that as the limit value). From there you can extract all devices that have the collector value you're looking to change and with that, you can then use the 'setCollector' method from the same router to assign the collector you need.

You can find the documentation for the version you're running in the following link: https://help.zenoss.com/zsd/archive/json-api

Best regards,

Adrian E. Vergara



------------------------------
Adrian Vergara
SRE
Zuora
------------------------------


Subject: RE: API to get the list of devices handled by a collector
Author: Sam Urai
Posted: 2019-11-05 23:19

Hello Adrian,

Many thanks for your reply and your guidance.  I'll try out the json api and see if I can pull the info I need.

Thanks

------------------------------
Sam
------------------------------


< Previous
zodbscan tool won't wokr
  Next
4.2.5 Collector setup
>