ZenModel/ZenPack.py contains the base ZenPack class. When a ZenPack is installed Zenoss inspects <YourZenPackId>/ZenPacks/..../<LastPartOfName>/__init__.py to see if it contains a class named ZenPack. If it does then Zenoss instantiates it otherwise Zenoss instantiates the base ZenModel.ZenPack.ZenPack class. That instance is then added to dmd.ZenPackManager.packs.
There are several attributes and methods of ZenPack that subclasses might be interested in overriding.
-
packZProperties is a mechanism for easily adding zProperties. packZProperties is a list tuples each containing three strings in this order: the name of the zProperty, the default value of the zProperty, and the type of the zProperty ('string', 'int', etc.) Zenoss will automatically create these when the ZenPack is installed and remove them when the ZenPack is removed. See ZenPacks.zenoss.MySqlMonitor for an example of this.
-
install(self, app) is called when the ZenPack is installed. If you override this be sure to call the inherited method within your code.
-
remove(self, app, leaveObjects) is called when the ZenPack is removed. As with install, make sure you call the inherited method if you override.