TECHZEN Zenoss User Community ARCHIVE  

Making a simple zenpack

Subject: Making a simple zenpack
Author: [Not Specified]
Posted: 2014-06-24 09:13

So I'm trying to implement a simple zenpack that checks a squid proxy via curl to google. I have written a proxycheck.sh that parses the curl output how I want. This all is fine. Now I'm trying to use the WebUI to export the zenoss monitoring template to a zenpack, add the script, and then link it appropriately on install. Per dhopps help on IRC, I modified an example script to the following:
import Globals
#
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
from Products.ZenUtils.Utils import unused
#
unused(Globals)
class ZenPack(ZenPackBase):
"""
"""

def install(self, app):
super(ZenPack, self).install(app)
self._symlinkScript()

def _symlinkScript(self):
os.system('ln -sf %s/proxycheck.sh %s/proxycheck.sh' %
(self.path('libexec'), zenPath('libexec')))

So I'm a bit confused why I get this traceback, I thought the import would fix it:
ERROR:zen.ZenossStartup:Error encountered while processing ZenPacks.CLASSE.ProxyMonitor
Traceback (most recent call last):
File "/opt/zenoss/Products/ZenossStartup/__init__.py", line 27, in
pkg_path = zpkg.load().__path__[0]
File "/opt/zenoss/lib/python/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/opt/zenoss/ZenPacks/ZenPacks.CLASSE.ProxyMonitor-1.0.0-py2.7.egg/ZenPacks/CLASSE/ProxyMonitor/__init__.py", line 48, in
class ZenPack(ZenPackBase):
NameError: name 'ZenPackBase' is not defined
ERROR:zen.ZenPackCmd:zenpack command failed
Traceback (most recent call last):
File "/opt/zenoss/Products/ZenUtils/zenpack.py", line 487, in
zp.run()
File "/opt/zenoss/Products/ZenUtils/zenpack.py", line 143, in run
self.connect()
File "/opt/zenoss/Products/ZenUtils/ZenScriptBase.py", line 52, in connect
setDescriptors(self.dmd)
File "/opt/zenoss/Products/ZenRelations/ZenPropertyManager.py", line 663, in setDescriptors
module = __import__(zpkg.module_name, globals(), locals(), fromlist)
File "/opt/zenoss/ZenPacks/ZenPacks.CLASSE.ProxyMonitor-1.0.0-py2.7.egg/ZenPacks/CLASSE/ProxyMonitor/__init__.py", line 48, in
class ZenPack(ZenPackBase):
NameError: name 'ZenPackBase' is not defined

Thanks for any guidance.

James Pulver

ZCA Member

CLASSE Computer Group

Cornell University



Subject: James,
Author: Andrew Kirch
Posted: 2014-07-07 15:33

James,

Keep in mind that we're running Dev Hours again. We'll be on a regular schedule by the end of the month but for now, please stop by at 4pm CST today or 9AM CST tomorrow

Andrew Kirch

akirch@gvit.com

Need Zenoss support, consulting or custom development Look no further. Email or PM me!

Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard



< Previous
I need to migrate event transforms from zenoss enterprise 2.5.2 to zenoss core 4 ...
  Next
Windows Event Log Monitoring
>