ZenDMD Tip - ShowEventMappingsAndTransforms

From Zenoss Wiki
Revision as of 20:13, 31 January 2013 by Eedgar (Talk | contribs)$7

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/opt/zenoss/bin/pythonimport Globalsfrom Products.ZenUtils.ZenScriptBase import ZenScriptBasedmd = ZenScriptBase(connect=True).dmdOrganizers = dmd.Events.getSubOrganizers()Organizers.insert(0, dmd.Events)def get_transforms():    for ec in Organizers:        if ec:            if ec.transform:                print "= %s ===" % ec.getOrganizerName()                print "<transform>"                print ec.transform                print "</transform>\n"                print            for i in ec.instances():                if (i.eventClassKey or i.rule or i.regex or i.transform) is not '':                    print "= %s/%s ===\n" % (ec.getOrganizerName(), i.id)                    if i.eventClassKey:                        print "<eventClassKey>"                        print i.eventClassKey                        print "</eventClassKey>\n"                    if i.rule:                        print "<rule>"                        print i.rule                        print "</rule>\n"                    if i.regex:                        print "<regex>"                        print i.regex                        print "</regex>\n"                    if i.transform:                        print "<transform>"                        print i.transform                        print "</transform>\n"                        printif __name__ == '__main__':    get_transforms()