![]() |
![]() |
Subject: | Can multiple ZenPacks provide the same Device Class? |
Author: | Matt |
Posted: | 2014-05-24 22:31 |
Hey guys,
I'm currently developing three ZenPacks which provide different subclasses under the same super class.
But all of them should be usable independently from each other.
Here is what it's going to look like:
But Zenoss only allows me to add the super class to one ZenPack (removes it from the other one automatically).
So is there a way to add the super class during the installation routine (__init__.py)
Or should I create a separate ZenPack that provides the super class and make all other ZenPacks depend on it
Thanks for your advice in advance.
Subject: | You can add the parent device |
Author: | Chet Luther |
Posted: | 2014-06-23 10:07 |
You can add the parent device class if it doesn't already exist during installation in the __init__.py file as you surmised. This is probably the best approach too. I can't seem to find an example in an open source ZenPack, but the CloudStack ZenPack does essentially the same thing to add a report organizer prior to installation.
https://github.com/zenoss/ZenPacks.zenoss.CloudStack/blob/develop/ZenPac...
You'd just call app.zport.dmd.Devices.createOrganizer('/Your/Device/Class') instead of app.zport.Reports.createOrganizer. This call is safe and will only create the organizer if it doesn't already exist. It also returns the existing or newly-created device class so you can configure it further if needed.
It's important to make the call to createOrganizer() before called "super(ZenPack, self).install(app)" to continue installing the ZenPack.
Subject: | Awesome! |
Author: | Matt |
Posted: | 2014-07-16 09:26 |
Awesome!
Thank you very much.
Here is how I implemented it:
superClass = app.zport.dmd.Devices.createOrganizer('/SuperClass')
ZenPackBase.install(self, app)
collectorPlugins = ['zenoss.snmp.DeviceMap', 'zenoss.snmp.NewDeviceMap', 'zenoss.snmp.InterfaceMap']
superClass.setZenProperty('zCollectorPlugins', collectorPlugins)
< |
Previous Oracle Zenpack error |
Next PySamba zenpack not installed... but it is |
> |