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

Login

Remember Me

Directory Tree

check_multiaddr

Rating
1 vote
Favoured:
0
Hits
132606
Files:
FileDescription
check_multiaddr.plCheck_multiaddr plugin - v0.1
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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.

INSTALLATION


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: 192.168.0.1,192.168.0.11,192.168.0.21

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:
192.168.0.1 & 192.168.0.11) 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 :

OK > WARNING > UNKNOWN > CRITICAL


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 :

address 192.168.0.1

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

address 192.168.0.1,192.168.0.11

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!192.168.0.1 # 1st IP address
...

}
define service{

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

}