Template-Based Extended Information Configuration File Options


Important: Nagios can be configured to use different extended data configuration file formats by using arguments to the configure script. This documentation describes how to configure extended data definitions if you've compiled Nagios with support for template-based extended info routines (which is now the default action).


Introduction

Template-based extended information definitions are stored in seperate configuration files, apart from the CGI configuration file. In order to tell the CGIs where to find your configuration information, you must add the following directive in your CGI configuration file:

xedtemplate_config_file=configuration_file

Example:

xedtemplate_config_file=/usr/local/nagios/etc/hostextinfo.cfg
xedtemplate_config_file=/usr/local/nagios/etc/serviceextinfo.cfg

You can split your configuration data into multiple files by adding more than one directive to your CGI configuration file. Details on host and service extended information defintions are provided below.

One of the benefits of using the template-based config file format is that you can create object definitions that have some of their properties inherited from other object definitions. The notion of object inheritence, along with documentation on how to do it, is described here. I strongly suggest that you familiarize yourself with object inheritence once you read over the documentation presented below, as inheritence will make the job of creating and maintaining object definitions much easier than it otherwise would be.

Index

Extended host information definitions
Extended service information definitions

Extended Host Information Definition

Description:

Extended host information entries are basically used to make the output from the status, statusmap, statuswrl, and extinfo CGIs look pretty. They have no effect on monitoring and are completely optional.

Definition Format:

Note: Variables in red are required, while those in black are optional. However, you need to supply at least one optional variable in each definition for it to be of much use.

define hostextinfo{
host_namehost_name
notes_urlurl
icon_imageimage_file
icon_image_altalt_string
vrml_imageimage_file
statusmap_imageimage_file
2d_coordsx_coord,y_coord
3d_coordsx_coord,y_coord,z_coord
   }

Example Definition:

define hostextinfo{
	host_name	netware1
	notes_url	http://webserver.localhost.localdomain/hostinfo.pl?host=netware1
	icon_image	novell40.png 
	icon_image_alt	IntranetWare 4.11
	vrml_image	novell40.png
	statusmap_image	novell40.gd2
	2d_coords	100,250
	3d_coords	100.0,50.0,75.0
	}

Variable Descriptions:

host_name: This variable is used to identify the short name of the host (as defined in your object configuration file) which the data is associated with.
notes_url: This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a link that says "Notes About This Host" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.
icon_image: This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).
icon_image_alt: This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.
vrml_image: This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be used as the texture map for the specified host in the statuswrl CGI. Unlike the image you use for the <icon_image> variable, this one should probably not have any transparency. If it does, the host object will look a bit wierd. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).
statusmap_image: This variable is used to define the name of an image that should be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIF image if you want, although I would strongly suggest using a GD2 format image, as other image formats will result in a lot of wasted CPU time when the statusmap image is generated. GD2 images can be created from PNG images by using the pngtogd2 utility supplied with Thomas Boutell's gd library. The GD2 images should be created in uncompressed format in order to minimize CPU load when the statusmap CGI is generating the network map image. The image will look best if it is 40x40 pixels in size. You can leave these option blank if you are not using the statusmap CGI. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).
2d_coords: This variable is used to define coordinates to use when drawing the host in the statusmap CGI. Coordinates should be given in positive integers, as the correspond to physical pixels in the generated image. The origin for drawing (0,0) is in the upper left hand corner of the image and extends in the positive x direction (to the right) along the top of the image and in the positive y direction (down) along the left hand side of the image. For reference, the size of the icons drawn is usually about 40x40 pixels (text takes a little extra space). The coordinates you specify here are for the upper left hand corner of the host icon that is drawn. Note: Don't worry about what the maximum x and y coordinates that you can use are. The CGI will automatically calculate the maximum dimensions of the image it creates based on the largest x and y coordinates you specify.
3d_coords: This variable is used to define coordinates to use when drawing the host in the statuswrl CGI. Coordinates can be positive or negative real numbers. The origin for drawing is (0.0,0.0,0.0). For reference, the size of the host cubes drawn is 0.5 units on each side (text takes a little more space). The coordinates you specify here are used as the center of the host cube.

Extended Service Information Definition

Description:

Extended service information entries are basically used to make the output from the status and extinfo CGIs look pretty. They have no effect on monitoring and are completely optional.

Definition Format:

Note: Variables in red are required, while those in black are optional. However, you need to supply at least one optional variable in each definition for it to be of much use.

define serviceextinfo{
host_namehost_name
service_descriptionservice_description
notes_urlurl
icon_imageimage_file
icon_image_altalt_string
   }

Example Definition:

define serviceextinfo{
	host_name		linux2
	service_description	Log Anomalies
	notes_url		http://webserver.localhost.localdomain/serviceinfo.pl?host=linux2&service=Log+Anomalies
	icon_image		security.png 
	icon_image_alt		Security-Related Alerts
	}

Variable Descriptions:

host_name: This variable is used to identify the short name of the host that the service is associated with.
service_description: This variable is description of the service (as defined in your object configuration file) which the data is associated with.
notes_url: This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a link that says "Notes About This Host" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.
icon_image: This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).
icon_image_alt: This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.