Last active
December 12, 2015 03:28
-
-
Save maxmanders/4706971 to your computer and use it in GitHub Desktop.
Enumerate Devices in a Zenoss deviceClass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pprint | |
import Globals | |
from Products.ZenUtils.ZenScriptBase import ZenScriptBase | |
from transaction import commit | |
dmd = ZenScriptBase(connect=True).dmd | |
find = dmd.Devices.findDevice | |
for device in dmd.Devices.getSubDevices(): | |
print device.id | |
print device.deviceClass | |
pprint.pprint device.deviceClass.__dict__ | |
# I'm trying to iterate over devices, get a devices associated deviceClass(es) | |
# and do some further processing if the deviceClass is e.g. | |
# /zport/dmd/Devices/AWS/ELB - | |
# The deviceClass is just a hash with an obj: parameter, and I'm not sure how to | |
# further work with that object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment