Community related pages, posts, and materials.

Zenoss ZenDMD Magic – Audit transforms

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
print "The following event classes have transforms associated with them:"
for eventClass in dmd.Events.getSubOrganizers():
    if eventClass.transform:
        print eventClass.getOrganizerName()
        print eventClass.transform
        print '-'*80

Zenoss ZenDMD Magic – Cleanup and remove duplicated object and properties

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: […]

Zenoss ZenDMD Magic – Fix Invalid Primary Parent on OS and HW

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 fixOsHwPrimaryParent(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 bad parents...' % (str(len(devicesToSearch)), deviceOrganizerToSearch)
        for d in devicesToSearch:
            try:
                testOs = d.os()
                testHw = d.hw()
            except:
                problemsFound = problemsFound + 1
                print "Device %s has a borked primary parent. Fixing" % (d.titleOrId())
                d.os.__primary_parent__ = d
                d.hw.__primary_parent__ = d
                if doItForReal == True:
                    commit()
    else:
        print "No devices scanned."
    if problemsFound > 0:
        print "Found and repaired a total of %s bad parents." % (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 problem parents on OS and HW."

Execute the method to search devices in the provided path for bad parent acquisition on OS and HW objects. Pass doItForReal to ‘True' for actions to be committed. Actions are not committed by default.

Examples:

fixOsHwPrimaryParent(doItForReal = True)