1. Introduction to ZenPacks

A ZenPack is a package that adds new functionality to the Zenoss. A ZenPack may add Action Rules, Event Classes, Event Commands, User Commands, Service Classes, Data Sources, Graphs, Performance Templates, Reports, Model Extensions or Product Definitions. A ZenPack may also add new daemons and new UI features such as menus.

ZenPacks are a mechanism for extending and modifying Zenoss. This can be as simple as adding new Device Classes or Performance Templates or as complex as extending the data model and providing new collection daemons. ZenPacks can be distributed for installation on other Zenoss systems. Simple ZenPacks can be created completely within the Zenoss user interface while more complex ZenPacks require development of scripts or daemons in Python or another programming language.

For example, say you have developed a Performance Template for a new piece of hardware. You've created Data Sources for the OID's you think are worth monitoring, Thresholds to make sure some of these values stay within reasonable limits and several Graph Definitions to show this data graphically. Perhaps you've also created a new Device Class for this hardware. You can create a ZenPack to easily distribute your Performance Template and Device Class to other Zenoss administrators. This ZenPack can be entirely created from within the Zenoss user interface.

For another example, say you want to monitor a new piece of software running on one of your servers. You would like to monitor several performance metrics of this software, but they are available only via a programmatic API provided with the software. You could develop a new collector daemon to gather data via this API and provide it back to Zenoss. You might also create a new type of Data Source to provide configuration data for the new collector. Obviously this effort would require development skills and intimate knowledge of Zenoss not necessary for the previous example, but this functionality can still be distributed as a ZenPack.

1.1. Installing ZenPacks

ZenPacks are usually distributed as .egg files. Zenoss also supports .zip files, though support for this format will be removed in a future version of Zenoss. ZenPacks of either type can be installed from the command line on the Zenoss server or via the Zenoss user interface.

1.1.1. Installing via the Command Line

The following ZenPack command can be used from the command line to install ZenPack files:

zenpack --install <filename>

If you have the source code for the ZenPack you can install directly from that rather than from a .egg or .zip file. The command is the same, you just specify the directory containing the source code. This copies the source code into either $ZENHOME/ZenPacks (for newer egg ZenPacks) or $ZENHOME/Products (for older style ZenPacks.)

zenpack --install <directoryname>

If you are developing a ZenPack you usually will want to maintain your source code outside of $ZENHOME/ZenPacks or $ZENHOME/Products. This is advisable for two reasons. First, if you issue a zenpack --remove command it will delete your code from either of those two locations and you would lose your files unless you had them backed up elsewhere. Second, if you are maintaining your source code in a version control system it is frequently more convenient to have the files reside elsewhere on the filesystem. Using the --link option you can install the ZenPack but have Zenoss use your code from its current location. Instead of installing your code in $ZENHOME/ZenPacks or $ZENHOME/Products Zenoss will create a link in one of those locations that points to your source code directory.

zenpack --link --install <directoryname>

1.1.2. Installing via the User Interface

You can upload and install a ZenPack .egg or .zip file via the user interface. From the Settings->ZenPacks page choose the Install Zenpack... menu item. In the dialog that follows use the Browse button to select the .zip file from your local computer. When you click the OK button the file is uploaded to the Zenoss server and installed.

1.1.3. Installing All Core ZenPacks via RPM

The Zenoss Core ZenPacks, along with third party ZenPacks, are available for download individually from http://www.zenoss.com/community/projects/zenpacks/. Also on that page is a link to download an RPM that includes the most popular Core ZenPacks. To install via the Core ZenPacks RPM follow these steps:

  1. Download the appropriate file from http://www.zenoss.com/community/projects/zenpacks/all-core-zenpacks

  2. Make sure zeo is running (as zenoss user):

    zeoctl start
  3. Install the rpm (as root user):

    rpm -ihv <rpm file>

1.2. Creating a ZenPack

When logged into Zenoss as an Administrator click on the Setting link and then on the ZenPacks tab. Select the "Create a ZenPack..." menu item. You will get a dialog asking for a name for your new ZenPack. The name must be of the form ZenPacks.<organization>.<identifier>, where organization is a name that identifies you or your organization and identifier is a string that represents the intent of your ZenPack. For example, ZenPacks.zenoss.HttpMonitor was created by zenoss to help monitor HTTP sites. Once you have entered a name click the save button. This creates both the ZenPack object in the database as well as a new directory in the filesystem $ZENHOME/ZenPacks/<your zenpack id>.

Many types of objects can be added to a ZenPack via the user interface. Some examples are:

  • Device Classes

  • Event Classes

  • Event Mappings

  • User Commands

  • Event Commands

  • Service Classes

  • Device Organizers

  • Performance Templates

Devices are the conspicuous omission from this list. Any individual Device is usually specific to a particular site and therefore not likely to be useful to other Zenoss users.

To add one of these database objects to a ZenPack navigate to that object and use the "Add to ZenPack..." menu item. Zenoss will present a dialog which lists all installed ZenPacks. Select the ZenPack to which you want to add this object and click the Add button. To view the objects that are part of a ZenPack navigate to the Settings page then the ZenPacks tab. Click on the name of the ZenPack and you will see a page that lists both the files and the objects that are part of this ZenPack. You can remove objects from the ZenPack by selecting the checkboxes next to them and using the "Delete from ZenPack..." menu item.

ZenPacks can contain items that are not zeo database items, such as new daemons, Data Source types, skins, etc. These are added to a ZenPack by placing them in the appropriate subdirectory within the ZenPack's directory. See the Core ZenPacks at http://www.zenoss.com/community/projects/zenpacks/ for examples of how to incorporate such items into your ZenPack. Further information regarding ZenPack development is available in the Zenoss Developers Guide.

Discussion regarding development of ZenPacks takes place on the zenoss-dev mailing list and forums: http://community.zenoss.com/forums/viewforum.php?f=3

1.2.1. Packaging and Distributing Your ZenPack

ZenPacks are usually distributed as .egg files. To create the installable .egg file for a ZenPack use the "Export ZenPack..." menu item in the page menu when viewing a ZenPack. The dialog that follows has two options. The first option simply exports the ZenPack to a file named <ZenPackId>.egg in the $ZENHOME/exports directory on the Zenoss server. The second option does the same but then downloads the exported file to your browser. Other Zenoss administrators can install this exported .egg file as described in the Installing ZenPacks section.

For information on how to make your ZenPack available on the zenoss.com site see http://www.zenoss.com/community/projects/zenpacks/how-to-contribute-a-zenpack

1.3. Removing a ZenPack

Warning: Removing a ZenPack can have unexpected consequences. For example, removing a ZenPack that installed a Device Class will remove both the Device Class and all Devices within that class. Also, before removing a ZenPack you should delete any Data Source of a type provided by the ZenPack. You should always perform a backup of your Zenoss data before removing a ZenPack. See Section 21.1 Backup and Restore for information on how to backup your Zenoss data.