Difference between revisions of "ZenDMD Tip - Remove Invalid Devices from Collectors"

From Zenoss Wiki
Jump to: navigation, search
m
m (tweak)
 
Line 12: Line 12:
 
             print "Removing %s from %s" % (d.id, p.id)
 
             print "Removing %s from %s" % (d.id, p.id)
 
             p.d._remove(d)
 
             p.d._remove(d)
 +
commit ()
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Don't forget to <tt>commit()</tt>
 
  
 
[[Category:Tips]]
 
[[Category:Tips]]
 
[[Category:ZenDMD]]
 
[[Category:ZenDMD]]

Latest revision as of 16:07, 21 November 2013

As the zenoss user, zendmd

from Products.ZenModel.PerformanceConf import PerformanceConf
for p in dmd.Monitors.Performance.objectValues():
    if not isinstance(p, PerformanceConf):
        continue
    for d in p.devices():
        try:
            bah = d.primaryAq()
        except:
            print "Removing %s from %s" % (d.id, p.id)
            p.d._remove(d)
commit ()