Difference between revisions of "ZenDMD Tip - Fix Broken Graph Report Elements"

From Zenoss Wiki
Jump to: navigation, search
(Created page with "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....")
 
(Formatting fixes)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
To fix Graph Reports broken by invalid or missing components, su zenoss and zendmd. Run the following.
 
To fix Graph Reports broken by invalid or missing components, su zenoss and zendmd. Run the following.
  
  children = dmd.Reports.children()
+
<syntaxhighlight lang=python>
  for c in children:
+
children = dmd.Reports.children()
      if c.id == "Graph Reports":
+
for c in children:
          for reportsParent in c.getSubOrganizers():
+
    if c.id == "Graph Reports":
              reports = reportsParent.reports()
+
        for reportsParent in c.getSubOrganizers():
              for r in reports:
+
            reports = reportsParent.reports()
                  for i in r.getElements():
+
            for r in reports:
                      ii = i.getComponent()
+
                for i in r.getElements():
                      if not ii:
+
                    ii = i.getComponent()
                          print "I couldn't get object " + str(i.id) + " listed in report " + str(r.id) + " in organizer " + str(reportsParent.id)  
+
                    if not ii:
                          r.elements.removeRelation(i)
+
                        print "I couldn't get object " + str(i.id) + " listed in report " + str(r.id) + " in organizer " + str(reportsParent.id)  
                          commit()
+
                        r.elements.removeRelation(i)
 +
                        commit()
 +
</syntaxhighlight>
  
 
+
[[Category:Tips]]
Best,
+
[[Category:ZenDMD]]
--Shane Scott (Hackman238)
+

Latest revision as of 14:16, 20 November 2013

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()