Home Directory Plugins Others check_multiaddr

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree


1 vote
check_multiaddr.plCheck_multiaddr plugin - v0.1
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Metaplugin used to check a service avalaible trough different IP addresses. Useful for Highly Avalaible clusters using several network interfaces.
This Perl script will execute another Nagios Plugin several times in parallel, using different addresses. It was developped for the folowing need : I have a highly redundant cluster where each host has 2 network interfaces, and when there is a problem, I want Nagios to distinguish :

- If the service has gone down, or
- If only an interface has gone down.


Copy this Perl script in your nagios/libexec directory, for example
/usr/local/nagios/libexec/. Don't forget to chown/chmod it so that
it is executable by Nagios.
HOW TO USE IT (./check_multiaddr.pl --help)

Check_multiaddr - Abstraction plugin for hosts using multiple interfaces
Usage: $0 /path/to/my/plugin my plugin arguments

Instead of using a single IP address, replace it by a set of addresses
separated by commas. Example:,,

This plugin uses an inner timeout of $TIMEOUT sec. You can edit it manually
inside this file : my $TIMEOUT = value;

********************************* EXAMPLE ************************************

Suppose you have a server with 2 network interfaces (using these IP addresses: & and executing a DNS server. If the first interface
goes down, the second one is used and reciprocally. This plugin allows you to
check the service no matter which interface (or which address) is used, by
testing each available address with the check_dns plugin.

If at least one instance of the DNS plugin returns 'OK', then we assume the
service is up. Else, Check_multiaddr will return the best state given by the
instanced plugins, using the following priority :


Now, to test our DNS service using multiple IP addresses:
1. We define a new check command

Add the following section in your 'check commands' definition file (in my
case, checkcommands.cfg):

define command{

command_name check_multiple_dns
command_line $USER1$/check_multiaddr.pl $USER1$/check_dns -H $ARG1$ -s $HOSTADDRESS$


2. We define our host with several addresses

... ie instead of typing :


... in our host definition (typically in hosts.cfg), we will use :


3. Then we create a service 'DNS'

This service will use 'check_multiple_dns' as check command :
define service{

service_description DNS
host_name Server4
check_command check_multiple_dns!www.google.com


4. Other services

Please note that Nagios will ALWAYS replace $HOSTADDRESS$ by THE TWO IP
addresses in check commands (including other services and host check). If
you also want to monitor each network interface, you can redefine a command
like this (it does not use $HOSTADDRESS$ but $ARG1$):

define command{

command_name check_if_alive
command_line $USER1$/check_ping -H $ARG1$ -w 3000.0,80% -c 5000.0,100%


And then define two more services on the host:
define service{

service_description eth0
host_name Server4
check_command check_if_alive! # 1st IP address

define service{

service_description eth1
host_name Server4
check_command check_if_alive! # 2nd IP address