Book Image

Nagios Core Administration Cookbook

By : Tom Ryder
Book Image

Nagios Core Administration Cookbook

By: Tom Ryder

Overview of this book

Network monitoring requires significantly more than just pinging hosts. This cookbook will help you to comprehensively test your networks' major functions on a regular basis."Nagios Core Administration Cookbook" will show you how to use Nagios Core as a monitoring framework that understands the layers and subtleties of the network for intelligent monitoring and notification behaviour. Nagios Core Administration Guide introduces the reader to methods of extending Nagios Core into a network monitoring solution. The book begins by covering the basic structure of hosts, services, and contacts and then goes on to discuss advanced usage of checks and notifications, and configuring intelligent behaviour with network paths and dependencies. The cookbook emphasizes using Nagios Core as an extensible monitoring framework. By the end of the book, you will learn that Nagios Core is capable of doing much more than pinging a host or to check if websites respond.
Table of Contents (18 chapters)
Nagios Core Administration Cookbook
About the Author
About the Reviewers

Defining macros in a resource file

In this recipe, we'll learn how to define custom user macros in resource files. This is good practice for strings used in check_command definitions or other directives that are shared by more than one host or service. For example, in lieu of writing the full path in a command_name directive as follows:

command_name=/usr/local/nagios/libexec/check_ssh $HOSTADDRESS$

We could instead write:

command_name=$USER1$/check_ssh $HOSTADDRESS$

As a result, if the location of the check_ssh script changes, we only need to change the value of $USER1$ in the appropriate resource file to update all of its uses throughout the configuration.

Most of the macros in Nagios Core are defined automatically by the monitoring server, but up to 32 user-defined macros can be used as well, in the form $USERn$.

Getting ready

You will need to have a server running Nagios Core 3.0 or later, and have access to the command line to change its configuration, in particular the resource.cfg file.