ZenDMD Tip - Fix Broken Graph Report Elements

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

To fix Graph Reports broken by invalid or missing components, su zenoss and zendmd. Run the following.

children = dmd.Reports.children()
for c in children:
    if c.id == "Graph Reports":
        for reportsParent in c.getSubOrganizers():
            reports = reportsParent.reports()
            for r in reports:
                for i in r.getElements():
                    ii = i.getComponent()
                    if not ii:
                        print "I couldn't get object " + str(i.id) + " listed in report " + str(r.id) + " in organizer " + str(reportsParent.id) 
                        r.elements.removeRelation(i)
                        commit()