Discussion:
New device modeler plugin not loading into zenmodeler
tcaiazza
2011-12-06 21:25:11 UTC
Permalink
tcaiazza [http://community.zenoss.org/people/tcaiazza] created the discussion

"New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63111#63111

--------------------------------------------------------------
I'm trying to write a modeler plugin for some devices to grab the serial number, I've setup some devices with the modeler plugins and they worked just fine.  However, one plugin just won't work even though the only difference with the broken modeler and the working ones is a different OID for the serial number

When I try to run the modeler manually, zenmodel says its only using the following 4 plugins

2011-12-06 15:47:50,154 DEBUG zen.ZenModeler: Using zenoss.snmp.NewDeviceMap on dist1-shcpa0915
2011-12-06 15:47:50,154 DEBUG zen.ZenModeler: Using zenoss.snmp.DeviceMap on dist1-shcpa0915
2011-12-06 15:47:50,155 DEBUG zen.ZenModeler: Using zenoss.snmp.InterfaceMap on dist1-shcpa0915
2011-12-06 15:47:50,155 DEBUG zen.ZenModeler: Using zenoss.snmp.RouteMap on dist1-shcpa0915

There should be one more from my zenoss.snmp.TestPluginMap.  The plugin is set under the device.  When I run zenhub in debug mode I see the following in the log.

2011-12-06 15:47:50,111 DEBUG zen.ModelerService: checking plugin zenoss.snmp.NewDeviceMap for device tester1
2011-12-06 15:47:50,111 DEBUG zen.ModelerService: adding plugin zenoss.snmp.NewDeviceMap for device tester1
2011-12-06 15:47:50,114 DEBUG zen.DbConnectionPool: Retrieved a connection; Pool size: 0
2011-12-06 15:47:50,114 DEBUG zen.DbConnectionPool: Returned a connection; Pool size: 1
2011-12-06 15:47:50,114 DEBUG zen.ModelerService: checking plugin zenoss.snmp.DeviceMap for device tester1
2011-12-06 15:47:50,114 DEBUG zen.ModelerService: adding plugin zenoss.snmp.DeviceMap for device tester1
2011-12-06 15:47:50,117 DEBUG zen.DbConnectionPool: Retrieved a connection; Pool size: 0
2011-12-06 15:47:50,117 DEBUG zen.DbConnectionPool: Returned a connection; Pool size: 1
2011-12-06 15:47:50,118 DEBUG zen.ModelerService: checking plugin zenoss.snmp.InterfaceMap for device tester1
2011-12-06 15:47:50,118 DEBUG zen.ModelerService: adding plugin zenoss.snmp.InterfaceMap for device tester1
2011-12-06 15:47:50,120 DEBUG zen.DbConnectionPool: Retrieved a connection; Pool size: 0
2011-12-06 15:47:50,121 DEBUG zen.DbConnectionPool: Returned a connection; Pool size: 1
2011-12-06 15:47:50,121 DEBUG zen.ModelerService: checking plugin zenoss.snmp.RouteMap for device tester1
2011-12-06 15:47:50,121 DEBUG zen.ModelerService: adding plugin zenoss.snmp.RouteMap for device tester1
2011-12-06 15:47:50,124 DEBUG zen.DbConnectionPool: Retrieved a connection; Pool size: 0
2011-12-06 15:47:50,124 DEBUG zen.DbConnectionPool: Returned a connection; Pool size: 1
2011-12-06 15:47:50,124 DEBUG zen.ModelerService: checking plugin zenoss.snmp.TestPluginMap for device tester1

But then nothing.  It seems something is getting hung up in zenhub which prevents zenmodeler from loading my TestPlugin. 

Anyone have any issues like this before?


Here is the actual code for ~/Products/DataCollector/plugins/zenoss/snmp/TestPluginMap.py

from CollectorPlugin import SnmpPlugin, GetMap


class TestPluginMap(SnmpPlugin):


    maptype = "TestPluginDeviceMap"


    snmpGetMap = GetMap({
             '.1.3.6.1.2.1.47.1.1.1.1.11.1' : 'setHWSerialNumber',
             })                                           


    def condition(self, device, log):
        """does device meet the proper conditions for this collector to run"""
        return device.snmpOid and device.snmpOid.startswith('1.3.6.1.2.1.47.1.1.1.1.11')




    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)
        getdata, tabledata = results
        return self.objectMap(getdata)

--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63111#63111]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2011-12-06 22:14:31 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63112#63112

--------------------------------------------------------------
I've hit similar in the past. One trick I learned was fire up zendmd and then try to manually import the class. I had a couple of times when It was 'doing nothing' like you describe, but when I manually tried the to import it threw the exception and I was able to see what I did wrong.

May or may not help, but its helped me in the past
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63112#63112]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2011-12-08 14:53:12 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63130#63130

--------------------------------------------------------------
This is the best advice.  When you don't see your modeler plugin in the zenmodeler list it is usually a syntax error in your code - indentation error? closing quote error?  As dpetzel says, use zendmd to import your module and it is more generous on debug info.

If you change the code, do remember to recycle zenhub and zopectl.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63130#63130]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
tcaiazza
2011-12-08 15:28:44 UTC
Permalink
tcaiazza [http://community.zenoss.org/people/tcaiazza] created the discussion

"Re: New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63150#63150

--------------------------------------------------------------
So how exactly would I load the plugin into zendmd?  Right now I don't have the modeler in a zenpack, and the only example I can find is Jane's from the zenpack paper.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63150#63150]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2011-12-08 17:53:30 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63156#63156

--------------------------------------------------------------
Sorry - for imports from standard Core directories, you need to give the path from $ZENHOME with dots rather than slashes, so you would have:

zendmd
from Products.DataCollector.plugins.zenoss.snmp import TestPluginMap

If you simply get the >>> prompt then it proves that at least it does compile.

The other thing to check (before doing the import) is in the Products/DataCollector/plugins/zenoss/snmp/ directory  whether there is a .pyc (compiled) file as well as your .py source file.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63156#63156]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
tcaiazza
2011-12-08 19:02:14 UTC
Permalink
tcaiazza [http://community.zenoss.org/people/tcaiazza] created the discussion

"Re: New device modeler plugin not loading into zenmodeler"

To view the discussion, visit: http://community.zenoss.org/message/63159#63159

--------------------------------------------------------------
Awesome that works.

So the issue with my modeler was the line

from CollectorPlugin import SnmpPlugin, GetMap

It wasn't finding the CollectorPlugin module, so I changed it to whats below and everything worked fine.

from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin, GetMap

Its odd though in my other working modelers I don't have the full path and they seem to work, I see the serial numbers for the device.  Granted when I tried to load them in zendmd they also failed.  Oh well, I justed updated all my plugins to use the full name for the CollectorPlugin module.

Thanks for the help guys!
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/63159#63159]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...