Hosts with multiple NICs


#1

I have installed nagios and configured a lot of what I want to monitor. There is one thing I can’t figure out how to do though. Here is my scenario:
I have two virtual servers. Server A and Server B.

They are configured in a manual failover. They each have their own unique IP address. They also have an IP address that they share. Both servers have a NIC assigned to them with the same MAC address and the same IP address. We simply disable and enable the NIC to failover the services. I want to monitor which server the failover MAC/NIC/IP is enabled on. On both servers eth0 is their own interface. Eth2 is the identical/shared interface. Can you guys give me some tips on how to do this? I am new so can you be as descriptive as possible? Thanks!


#2

I am not sure how you are using nagios, but a simple way would be to run a check on the fail-over boxes IP. I will use the check_nrpe command for this because its quite simple.

Lets say… the script is called check_failover:

BOX 1: /usr/local/nagios/libexec/check_failover
#!/bin/bash
echo "OK: I AM BOX 1"
exit 0

BOX 2: /usr/local/nagios/libexec/check_failover
#!/bin/bash
echo "OK: I AM BOX 2"
exit 0

nrpe.cfg file:

command[check_failover]=/usr/local/nagios/libexec/check_failover

Nagios check command (You might have this or something list this already):

‘check_nrpe’ command definition

define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Service command:

define service{
use generic-service ; Name of service
host_name failover
service_description Check Failover
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups nobody
check_command check_nrpe!check_failover
}

Host command:

Just set it up for the ip that is the same on either box.

Well that way should work. There are other ways that you could do it aswell probably. Let me know if you have major problems.


#3

Thanks Joey! That looks like it will work for me!


#4

One more question. Would this return a critical if the IP is unreachable?