Skip to content

Instantly share code, notes, and snippets.

@cluther
Created July 11, 2011 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cluther/1076520 to your computer and use it in GitHub Desktop.
Save cluther/1076520 to your computer and use it in GitHub Desktop.
Fix Collector Associations
# Remove non-existent devices from performance monitors
from Products.ZenModel.PerformanceConf import PerformanceConf
for pmon in dmd.Monitors.Performance.objectValues():
if not isinstance(pmon, PerformanceConf): continue
for device in pmon.devices():
try:
bah = device.primaryAq()
except Exception:
print "Removing %s from %s" % (device.id, pmon.id)
pmon.devices._remove(device)
# Save changes
commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment