Zero in Nagios

If you have a Zero Service running at some URL like http://zero.example.org/zero/, it’s quite simple to connect host objects in Nagios to the correct view of performance data.

Nagios provides two host attributes for this purpose: action_url, notes_url

In my setup I included the following attributes to my host template:

action_url http://zero.example.org/zero/rrd_view?hostname=$HOSTNAME$
notes_url http://wiki.example.org/mediawiki/?search=$HOSTNAME$,$SERVICEDESC$

If notes_url renders useful, depends a little bit on the structure of your Wiki, but you can as well call a helper script on the web server associated with it to lookup/generate document links. It’s already prepared for use in a service object. Beware that many variables, that work in command declarations will not work in these attributes.

In a not-so-perfect environment with Zero Agents using the system’s hostname, that are not appropriate for use as Nagios HOSTNAME, I used a custom attribute __NAME instead of HOSTNAME in the URLs. Here is an example:

A host is running 3 network interfaces on IPs host0001a.example.org, host0001b.example.org, host0001c.example.org, the hostname of the system points to host0001a, but I want to name it host0001 without suffix in Nagios. For this I just set __NAME to host0001a and setup action_url http://zero.example.org/zero/rrd_view?hostname=$_HOST_NAME$ (see Nagios documentation for interpretation of __NAME).