Difference between revisions of "ZenDMD Tip - ShowAllTransforms"

From Zenoss Wiki
Jump to: navigation, search
Line 1: Line 1:
<syntaxhighlight lang=python>
+
<syntaxhighlight lang=javascript>
#!/usr/bin/env pythonimport Globalsfrom Products.ZenUtils.ZenScriptBase import ZenScriptBasedmd = ZenScriptBase(connect=True).dmdfor ec in dmd.Events.getSubOrganizers():   if ec.transform:       print "= %s ===" % ec.getOrganizerName()       print ec.transform        print    for i in ec.instances():       if i.transform:           print "= %s/%s ===" % (ec.getOrganizerName(), i.id)           print i.transform           print
+
#!/usr/bin/env pythonimport Globals
 +
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
 +
dmd = ZenScriptBase(connect=True).dmd
 +
for ec in dmd.Events.getSubOrganizers():
 +
    if ec.transform:
 +
        print "= %s ===" % ec.getOrganizerName()
 +
        print ec.transform         
 +
        print     
 +
    for i in ec.instances():
 +
        if i.transform:
 +
            print "= %s/%s ===" % (ec.getOrganizerName(), i.id)
 +
            print i.transform
 +
            print
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Tips]]
 
[[Category:Tips]]

Revision as of 20:09, 31 January 2013

#!/usr/bin/env pythonimport Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
dmd = ZenScriptBase(connect=True).dmd
for ec in dmd.Events.getSubOrganizers():
    if ec.transform:
        print "= %s ===" % ec.getOrganizerName()
        print ec.transform        
        print    
    for i in ec.instances():
        if i.transform:
            print "= %s/%s ===" % (ec.getOrganizerName(), i.id)
            print i.transform
            print