ZenDMD Tip - ShowEventMappingsAndTransforms

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search
#!/opt/zenoss/bin/python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
dmd = ZenScriptBase(connect=True).dmd
Organizers = 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"
                        print
 
if __name__ == '__main__':
    get_transforms()