Command Line Usage

While most of zenpacklib’s functionality is as a Python module to be used as a library for helping build ZenPacks, also acts as a command line script to perform some useful actions.

You can choose to make executable then execute it as as script.

chmod 755

Or you can leave it non-executable and execute it through python.


In either case you will get the following help.

Usage: <command> [options]

Available commands and example options:

  # Check zenpack.yaml for errors.
  lint zenpack.yaml

  # Print yUML ( class diagram source based on zenpack.yaml.
  class_diagram yuml zenpack.yaml

  # Export existing monitoring templates to yaml.
  dump_templates ZenPacks.example.AlreadyInstalled

  # Convert a pre-release zenpacklib.ZenPackSpec to yaml.
  py_to_yaml ZenPacks.example.AlreadyInstalled

  # Print zenpacklib version.

The following commands are supported:

  • create: Create a new zenpacklib-enabled ZenPack source directory.
  • lint: Provides syntax and correctness on a YAML file.
  • class_diagram: Export yUML ( class diagram from a YAML file.
  • dump_templates: Export existing monitoring templates to YAML.
  • py_to_yaml: Converts the Python syntax used in pre-release versions of zenpacklib to YAML.
  • version: Print zenpacklib version.


The create command will create a source directory for a zenpacklib-enabled ZenPack. This will include a,, the namespace and module directories, and a zenpack.yaml in the module directory. It will also make a copy of inside the module directory. This ZenPack will be ready to be installed immediately though it will contain no functionality yet.

Example usage:

python create ZenPacks.example.MyNewPack

Running the above command would result in the following output.

Creating source directory for ZenPacks.test.ZPLTest2:
  - making directory: ZenPacks.test.ZPLTest2/ZenPacks/test/ZPLTest2
  - creating file: ZenPacks.test.ZPLTest2/
  - creating file: ZenPacks.test.ZPLTest2/
  - creating file: ZenPacks.test.ZPLTest2/ZenPacks/
  - creating file: ZenPacks.test.ZPLTest2/ZenPacks/test/
  - creating file: ZenPacks.test.ZPLTest2/ZenPacks/test/ZPLTest2/
  - creating file: ZenPacks.test.ZPLTest2/ZenPacks/test/ZPLTest2/zenpack.yaml
  - copying: ../../../ to ZenPacks.test.ZPLTest2/ZenPacks/test/ZPLTest2


The lint command will check the provided YAML file for correctness. It checks that the provided file is syntactically-valid YAML, and it will also perform many others checks that validate that the contained entries, fields and their values are valid.

The following example shows an example of using an unrecognized parameter in a monitoring template.

python lint zenpack.yaml
zenpack.yaml:47:9: Unrecognized parameter 'targetPythnoClass' found while processing RRDTemplateSpec


lint will provide no output if the provided YAML file is found to be correct.


The class_diagram command will use Classes and Relationships in the provided YAML file to output the source for a yUML ( class diagram. For ZenPacks with a non-trivial class model this can provide a useful view of the model.

Using this example zenpack.yaml with class_diagram..

name: ZenPacks.example.NetBotz

    base: [zenpacklib.Device]

    base: [zenpacklib.Component]

    base: [zenpacklib.Component]

  - NetBotzDevice 1:MC NetBotzEnclosure
  - NetBotzDevice 1:MC NetBotzSensor
  - NetBotzEnclosure 1:M NetBotzSensor

Then running the following command..

python class_diagram yuml zenpack.yaml

Would result in the following yUML class diagram source. You can now paste this into to see what it looks like.

# Classes

# Inheritence

# Containing Relationships

# Non-Containing Relationships


The py_to_yaml command is designed for a very specific purpose that most people will not find useful. Earlier pre-release versions of zenpacklib required that the ZenPack be defined via a call to zenpacklib.ZenPackSpec() with Python data structures instead of via a YAML file. py_to_yaml converts this style of definition to a YAML file suitable for use with current versions of zenpacklib.

Example usage:

python py_to_yaml ZenPacks.example.BetterAlreadyBeInstalled


The dump_templates command is designed to export monitoring templates already loaded into your Zenoss instance and associated with a ZenPack. It will export them to the YAML format required for zenpack.yaml. It is up to you to merge that YAML with your existing zenpack.yaml. file.

Example usage:

python dump_templates ZenPacks.example.BetterAlreadyBeInstalled


The version command prints the zenpacklib version.

Example usage:

python version