Skip navigation
Currently Being Moderated

Using Nagios Plugins with Zenoss

Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:21 AM by Noel Brockett

How to use Nagios Plugins in Zenoss

Working with Nagios Plugins in Zenoss

In this HowTo we will use the Nagios check_http plugin to check for specific content of a web page (implicity checking for server/page 200 status as well).

Test the Plugin without Zenoss

The first thing you want to do is make sure that the plugin works from the command line. If it does, you're ready to work with the plugin in Zenoss. For example:

rohan:zenoss 14:06:05 $ /usr/local/zenoss/libexec/check_http -H -u /product -s "Zenoss, Inc."
HTTP OK HTTP/1.0 200 OK - 0.723 second response time |time=0.722758s;;;0.000000 size=7932B;;;0


For details on the parameters passed to various Nagios plugins, be sure to consult the plugin documentation and usage examples.


We see that this works and are ready for the next step.

Determining the Device Scope

Next we need to think about where this plugin will run. Will it run for all devices? For all Linux boxen? For all web pages? Depending on the answer to these questions, you will configure your Nagios template in a different location of the Zenoss device tree. Obviously, this particular check will only pertain to a web server or a cluster of web servers serving the same content.

Choosing a Template

Once you've chosen the location for your Nagios plugin to run, you will need to navigate to that location. Once there, locate and then click on the "PerfConf" tab. At this point you can either use one of templates displayed or add a new one.


Note that if you change the top-level Devices -> PerfConf -> Device template, all devices below this point that do not have their own PerfConf customizations will use the changes you make.

Adding a Nagios Command

Here are the steps needed to create our new commmand (assuming that you've got a device called '' that points to the Zenoss web server):

  • navigate to Devices -> Server -> Linux ->
  • click on the "PerfConf" tab
  • we want to make changes for this particular host, so we will then click the "Local Copy" button (towards the top of the page)
  • we are now able to edit the various data sources that were defined at the higher level (of which we just made a copy), however, we want to add our own
  • at the bottom of the "Data Sources" section, there is a form field with the buttons "Add", "Delete", and "Select All"
  • in the form field, enter the names of the check you are creating and then click "Add"; for this example, we will use the name productPageCheck
  • when the page refreshes, you will see "productPageCheck" in the list of Data Sources
  • click on the productPageCheck link
  • on the next page, select "COMMAND" from the "Source Type" drop-down


Before we make changes, let's go through the fields that became available to us once we selected the COMMAND source type:

  • Name - what we named the data source when we created it
  • Source Type - the means by which this data source will be obtaining data; support for Nagios and Cacti plugins is bundled in the "COMMAND" source type
  • Enabled - whether or not this data source will be used when regular checks are performed
  • Use SSH - whether or not SSH is required to run this check
  • Component - the Zenoss component with which we want to annotate any events generated from the check of this data source; see the "component" column when viewing /zport/dmd/Events/viewEvents
  • Event Class - the type of event; this will annotate the event and show up in the "eventClass" column when viewing /zport/dmd/Events/viewEvents
  • Event Key - this is used by Zenoss to prevent the duplication of events; Component, Event Class and Event Key are used to determine uniqueness of source for alerts
  • Severity - the severity for the failure of this check
  • Cycle Time - the interval (in seconds) between checks of this data source
  • Command Template - what to run (more details below)


Thus informed, we can now edit the data source, entering our Nagios-specific information. We've already got our data source's name and source type, so let's continue from there:

  • Enabled - set to "True"
  • Use SSH - set to "False"
  • Component - set to "pagechecks"
  • Event Class - "/Net"
  • Event Key - set to "Zenoss Product Page"
  • Severity - set to "Warning"
  • Cycle Time - set to 60
  • Command Template - set to the following:
    /usr/local/zenoss/libexec/check_http -H $devname -u /product -s "2005-2006, Zenoss, Inc."


Our device's name is "", so using ${devname} works for our example. If your device's name is not resolvable, then you can use the following instead:


/usr/local/zenoss/libexec/check_http -H  ${dev/manageIp} -u /product -s "2005-2006, Zenoss, Inc."


To test your new command, at the command line, use the zencommand tool:


zencommand run -d -v10


In the output, you should see zencommand find the new command, execute it, and store the results.

Restart zencommand

Once you're satisfied your command is working, you must restart the zencommand process to make the daemon pick up your change.

This completes the setup and configuration of a Nagios style
Comments (0)