Difference between revisions of "ZenDMD Tip - Dump zProperties values for a Device"

From Zenoss Wiki
Jump to: navigation, search
m
m
 
Line 9: Line 9:
 
     value = d.getProperty(prop_id)
 
     value = d.getProperty(prop_id)
 
     print "{0} - {1}".format(prop_id, value)
 
     print "{0} - {1}".format(prop_id, value)
</syntaxhighlight>[[Category:Tips]][[Category:ZenDMD]]
+
</syntaxhighlight>
 +
 
 +
[[Category:Tips]]
 +
[[Category:ZenDMD]]

Latest revision as of 14:23, 20 November 2013

For a variety of reasons, you may want to dump the current values of all zProperties on a device.

The following snippet will print out the property name and value. You can get as creative as you want rather than simply printing them to the screen.

d = dmd.Devices.findDevice('device_name') #Set this to your devices name
for prop_id in d.zenPropertyIds():
    value = d.getProperty(prop_id)
    print "{0} - {1}".format(prop_id, value)