Plugin format for ZenCommands

Nagios® plugins are configured by using a command template.

A template named “Device” will bind to all devices below the template definition. Within each template is a list of commands that will run. The commands can be any program that follows the Nagios® plug-in standard. Inputs are command line arguments; output is the first line of stdout, plus a return code.

 Value Resource Manager  Nagios
0 Clear OK
1 Data Source WARNING
2 Data Source+1 CRITICAL
3 Data Source UNKNOWN

For comprehensive information about Nagios® plugins, refer to the Nagios Plugin Development Guidelines.

A Nagios® command has several fields:

  • name – Specifies the name of the command object.

  • enabled – Indicates whether this command should be used on a given device.

  • component – Specifies the component name to use when zencommand sends events to the system.

  • event class – Specifies the event class to use when sending events to the system.

  • severity – Sets the default severity to use when sending events to the system.

  • cycle time – Sets the frequency a command should be run (in seconds).

  • command template – Specifies the command to run.

    The command template string is built by using Zope TALES expressions. Several variables are passed when evaluating the template. They are:

  • zCommandPath – Path to the zencommand plug-ins on a given box it comes from the configuration property zCommandPath. zCommandPath is automatically added to a command if a path is absent from the beginning of the command.

  • devname – Device name of the device against which the command is being evaluated.

  • dev – Device object against which the command is being evaluated.

  • here – Context of evaluation. For a device, this is equivalent to dev for a component (such as a file system or interface). This is the component object.

  • compname – If this command evaluates against a component, specifies its name as a string.

  • now – Current time.

    Template values are accessed like shell variables. They are the same as the expression syntax used in the appendix titled TALES Expressions (in this guide).