Configuration & Administration

Expand all | Collapse all

API to get the list of devices handled by a collector

  • 1.  API to get the list of devices handled by a collector

    Posted 10-28-2019 09:29 PM
    Edited by Sam Urai 10-28-2019 09:46 PM
    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
    ------------------------------


  • 2.  RE: API to get the list of devices handled by a collector

    Posted 10-29-2019 02:10 PM

    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
    ------------------------------



  • 3.  RE: API to get the list of devices handled by a collector

    Posted 11-05-2019 10:19 PM
    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
    ------------------------------