As the zenoss user on the ZenMaster, zendmd.

Copy and paste in the following definition:

## Copyright 2015 GoVanguard Inc. Written by Shane William Scott. http://gvit.com
def excisePropertyTumor(deviceOrganizerToSearch = '/zport/dmd/Devices', doItForReal = False):
    sync()
    problemsFound = 0
    if deviceOrganizerToSearch != None:
        print "Getting organizer..."
        organizerOb = dmd.Devices.getOrganizer(deviceOrganizerToSearch)
        if organizerOb:
            print "Collecting device list..."
            devicesToSearch = organizerOb.getSubDevices()
    if len(devicesToSearch) > 0:
        print 'Searching %s devices in %s for duplicates in _properties...' % (str(len(devicesToSearch)), deviceOrganizerToSearch)
        for d in devicesToSearch:
            oldObs = d._properties
            newObs = list(set([str(propId) for propId in d._properties]))
            if len(oldObs) > len(newObs):
                problemsFound = problemsFound + 1
                print "Device %s has duplicates in _properties. Fixing." % (d.titleOrId())
                d._properties = tuple([eval(propId) for propId in newObs])
                if doItForReal == True:
                    commit()
    else:
        print "No devices scanned."
    if problemsFound > 0:
        print "Found and cut out a total of %s property duplicates." % (str(problemsFound))
        if doItForReal == False:
            print "...but doItForReal was set to False so the changes are not commited"
    else:
        print "Congrats! You're clean! Nothing showed up during the scan for duplicated properties."

## Copyright 2015 GoVanguard Inc. Written by Shane William Scott. http://gvit.com
def exciseObjectTumor(deviceOrganizerToSearch = '/zport/dmd/Devices', doItForReal = False):
    sync()
    problemsFound = 0
    if deviceOrganizerToSearch != None:
        print "Getting organizer..."
        organizerOb = dmd.Devices.getOrganizer(deviceOrganizerToSearch)
        if organizerOb:
            print "Collecting device list..."
            devicesToSearch = organizerOb.getSubDevices()
    if len(devicesToSearch) > 0:
        print 'Searching %s devices in %s for duplicates in _objects...' % (str(len(devicesToSearch)), deviceOrganizerToSearch)
        for d in devicesToSearch:
            oldObs = d._objects
            newObs = list(set([str(obId) for obId in d._objects]))
            if len(oldObs) > len(newObs):
                problemsFound = problemsFound + 1
                print "Device %s has duplicates in _objects. Fixing." % (d.titleOrId())
                d._objects = tuple([eval(obId) for obId in newObs])
                if doItForReal == True:
                    commit()
    else:
        print "No devices scanned."
    if problemsFound > 0:
        print "Found and cut out a total of %s object entry duplicates." % (str(problemsFound))
        if doItForReal == False:
            print "...but doItForReal was set to False so the changes are not commited"
    else:
        print "Congrats! You're clean! Nothing showed up during the scan for duplicated object entries."
Execute the each method to search devices in the provided path for duplicate object references and duplicate property refernces. Pass doItForReal to ‘True' for actions to be committed. Actions are not committed by default.

Examples:

exciseDuplicatedProperties(doItForReal = True)
exciseDuplicatedObjects(doItForReal = True)