Developer's Guide

  • Docs Home
  • Community Home

2. Creating a ZenPack

ZenPacks can be created through the Zenoss user interface by using the Create ZenPack… menu item on the ZenPacks page. This creates the ZenPack on the file system at $ZENHOME/ZenPacks/zenpackid and installs it into Zenoss.

2.1. ZenPack Names

ZenPack names consist of at least three strings joined by periods. The first of these strings is always "ZenPacks." Each of these strings must start with a letter and contain only letters, numbers and underscores. The reason for this naming scheme is that the ZenPack will setup namespaces in Python that reflect these names. There is a Python namespace called ZenPacks. Within that namespace are packages representing the second part of all the installed ZenPack and so on. So for example if you have a ZenPack named ZenPacks.MyCompany.MyZenPack then it is importable in Python (and zendmd) as

import ZenPacks.MyCompany.MyZenPack

A data source class provided by this example might be accessed as

from ZenPacks.MyCompany.MyZenPack.datasources.MyDataSourceClass \
         import MyDataSourceClass

The advantage of these namespaces is that they help prevent namespace conflicts between different organizations authoring ZenPacks. So if a third party wants to develop an HTTP monitoring ZenPack they could name it ZenPacks.OurCompany.HttpMonitor and it would not conflict with the ZenPacks.zenoss.HttpMonitor Core ZenPack.

2.2. Specifying Dependencies

The ZenPack Edit page allows you to specify versions of Zenoss that your ZenPack is compatible with as well as dependencies on other ZenPacks. The first item in the Dependencies section of that page is the version of Zenoss that is required. If that field is blank then your ZenPack will be installable under any version of Zenoss version 2.2 or later. If you enter a specific version number then the ZenPack will run only under that exact version of Zenoss, this is usually not desirable. The most typical version requirement is to specify that the ZenPack is compatible with any version of Zenoss equal to or greater than a specific version. The syntax for this is ">=X" where X is the minimum version the ZenPack requires. For example, if a ZenPack requires Zenoss version 2.2.1 or greater the version specification would be >=2.2.1.

Below the Zenoss version specification is a list of all other ZenPack eggs installed. Old-style (non-egg) ZenPacks cannot be listed as dependencies and do not appear in this list. If your ZenPack requires another ZenPack to be installed then check the checkbox to the left of the other ZenPack's name. Optionally you can also give a version specification for each ZenPack you require.

2.3. Locating ZenPack Source Outside of Zenoss

For any non-trivial ZenPacks we recommend maintaining the source code somewhere other than $ZENHOME/ZenPacks. There are a couple reasons for this:

  • Performing a zenpack --remove deletes the ZenPack's directory from $ZENHOME/ZenPacks. If you do not have the files copied in another location you can easily lose all or some of your work.

  • If your ZenPack source is maintained in a version control system it is frequently easier to keep the code within a larger checkout directory elsewhere on the filesystem.

To move a ZenPack source directory out of $ZENHOME/ZenPacks you can simply copy the directory to the new location then run install again using the --link option. This will remove the $ZENHOME/ZenPacks/YourZenPackId directory.

cp -r $ZENHOME/ZenPacks/YourZenPackId SomeOtherDirectory
zenpack --link --install SomeOtherDirectory/YourZenPackId

2.4. Community ZenPack Subversion Access

There is a Community ZenPack development site for hosting Subversion source code control access to all contributed Community ZenPacks. Accounts will be granted by request and offered to ZenPack contributors. The goal of this site is to encourage ZenPack development and open up improvements to all ZenPacks to a greater audience.

The Community ZenPack development site contains instructions for:

  • working with Community ZenPacks from Subversion

  • building and modifying ZenPacks

  • converting old-style ZenPacks to Python Egg ZenPacks