Follow

How To Remove a Modeler Plugin System-Wide

Pre-Requisites

  • Administrators undertaking this procedure should have a thorough understanding of zendmd

Applies To

  • Zenoss 4.x
  • Zenoss 3.1.x
  • Zenoss 3.0.x
  • Zenoss 2.5.x

Summary

Device classes in Resource Manager have a configuration property named 'zcollectorplugins' listing the collector plugins that are used to model devices placed in the device class. Some values may exist for a class' zcollectorplugins that reference non-existent plugins. To prevent confusion, such invalid references can be removed by running a zendmd script that will search for and remove invalid collector plugin configuration property values system-wide. The following example script compares a list of real modeler plugins to the list of modeler plugins referenced by the devices class in Resource Manager, and removes references to plugins that do not exist.

Create the script

  1. Create a new script, for example myzendmdscript.
  2. Edit the script and add the following code:
    def intersect(a,b):
        return list(set(a) & set(b))
    def difference(a,b):
        return list(set(a) - set(b))
    
    from Products.DataCollector.Plugins import loadPlugins
    from pprint import pprint
    pluginNames = [ ldr.pluginName for ldr in loadPlugins(dmd) ]
    
    toCheck = dmd.Devices.getOverriddenObjects('zCollectorPlugins',showDevices=True)
    
    # Check the top level
    toCheck.insert(0,dmd.Devices)
    
    for obj in toCheck:
        if difference(obj.zCollectorPlugins,pluginNames):
            print "Found an invalid zCollector Plugin at %s[%s]" % ( obj.titleOrId(),obj)
            print "Removing these invalid entries"
            print difference(obj.zCollectorPlugins,pluginNames)
            print
            result = intersect(pluginNames,obj.zCollectorPlugins)
            obj.setZenProperty('zCollectorPlugins',result)
    
    commit()
  3. Save your script and exit the editor.

 

Run the script

To run your new script:

  1. Switch to the zenoss user:
    # su zenoss
  2. Run the zendmd command with your new script name as an option, for example:
    $ zendmd --script=myzendmdscript

The following example output shows successful script execution. 

Found an invalid zCollector Plugin at Discovered[]
Removing these invalid entries
['zenoss.cmd.lin ux.ifconfig']

Found an invalid zCollector Plugin at Nexus[]
Removing these invalid entries
['zenoss.snmp.CiscoDevice']

Found an invalid zCollector Plugin at 7000[]
Removing these invalid entries
['zenoss.snmp.CiscoDevice']

Found an invalid zCollector Plugin at Solaris[]
Removing these invalid entries
['zenoss.cmd.solaris.ifconfig', 'zenoss.cmd.solaris.cpu', 'zenoss.cmd.solaris.so      laris_uname_a']

Found an invalid zCollector Plugin at Xen[]
Removing these invalid entries
['zenoss.snmp.HPCPUMap', 'zenoss.snmp.HPDeviceMap', 'zenoss.snmp.DellCPUMap', 'z      enoss.snmp.DellPCIMap', 'zenoss.snmp.DellDeviceMap']
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk