I am new to Zenoss. I would like to know if there is any way to get the UID based on the device name. For example, in vCenter i have a VM with name 'MyTestVM' and i can see that in Zenoss Infrastructure section. I am developing a portal to show the monitoring graphs of CPU and Memory from zenoss. In order to do that i need to pass the UID to one of its API and i dont know how to get that UID of any device (VM specifically).
Any help here would be really helpful.
Regards, Kiran
PS: Please help me out if there is any confusion in this question.
You have a few options, depending on what you need to.
The quick and ugly way, is to pull the UID, or UUID from your browser.
navigate to the device details page under infrastructure/devices/...
the UID should appear in your address bar. if the URL is "https://zenoss5.zenoss-host-name/zport/dmd/Devices/Server/Linux/devices/x.x.x.x/devicedetail#deviceDetailNav:device_overview" then your UID is "/zport/dmd/Devices/Server/Linux/devices/x.x.x.x"
you can also find the UUID by inspecting the page source and searching for "uuid"
The fun and more automatable way, is to use zendmd to look it up.
see the documentation here: support.zenoss.com: zendmd intro
zendmd
Find the device using its name:
In [1]: find('MyTestVM') Out[1]: <Device at /zport/dmd/Devices/Server/Linux/devices/x.x.x.x> In [2]: mydevice = find('MyTestVM') Out[3]: '3c5a857a-7d9f-4df9-bff9-2fcb9a07acbc'
get the details you need from your dmd device:
In [3]: mydevice.getUUID() Out[3]: '3c5a857a-7d9f-4df9-bff9-2fcb9a07acbc'
In [4]: mydevice.getId() OUT[4]: 'x.x.x.x'
The best way, is probably to use the JSON API.
there is a json api guide, and full API documentation