Skip to content

Instantly share code, notes, and snippets.

@maxmanders
Last active December 12, 2015 03:28
Show Gist options
  • Save maxmanders/4706971 to your computer and use it in GitHub Desktop.
Save maxmanders/4706971 to your computer and use it in GitHub Desktop.
Enumerate Devices in a Zenoss deviceClass
#!/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