Monitoring dualstacked systems with Icinga

Since some ages we are deploying IPv6 in our network and also for some selected services. Some days ago we discovered, that anybody has enabled accidentally a router advertisement daemon in a network where this shouldn't happen. As result of this, IPv6 enabled systems got (additional) IPv6 addresses and some services where using this new learned addresses as source address when sending out replies.

Maybe this doesn't sound so harmful on the first view. But some services rely on a correct source address when getting a reply for a request (for example dns resolver library).

To be aware of the issue, that a service maybe available via IPv4 but not via IPv6 or vica versa, a dualstacked monitoring needs to be in place for dualstacked services. Looking into the issue, I stumbled upon Michael Friedrichs HowTo about dualstacked monitoring with Icinga.

Luckily we have the full software stack in place on Squeeze (with squeeze-backport). As icinga and nagios-plugins was in installed already, I just needed to fetch check_multi.

# aptitude install -t squeeze-backports nagios-plugin-check-multi

Now a new check command is needed, I created the following:

define command {
	command_name	check_multi_icinga
	command_line	/usr/lib/nagios/plugins/check_multi \
	-f /etc/check_multi/$ARG1$ $ARG2$ $ARG3$ $ARG4$ \
	-s objects_cache=/var/cache/icinga/objects.cache \
	-s status_dat=/var/cache/icinga/status.dat \
	-s HOSTADDRESS=$HOSTADDRESS$ -s HOSTADDRESS6=$HOSTADDRESS6$
}

For monitoring connectivity I created check_host_alive_dualstack.cmd

command[ IPv4 ]         = check_ping -4 -H "$HOSTADDRESS$" -w 5000.0,100% -c 5000.0,100% -p 5
command[ IPv6 ]         = check_ping -6 -H "$HOSTADDRESS6$" -w 5000.0,100% -c 5000.0,100% -p 5
state   [ CRITICAL   ] = COUNT(CRITICAL) > 1
state   [ WARNING    ] = COUNT(WARNING) > 0 || COUNT(CRITICAL) > 0
state   [ UNKNOWN    ] = COUNT(UNKNOWN) > 1

Now we just need to replace the check-host-alive command and add a value for  "address6" on the host as the following

define host{
	use                     generic-host            ; Name of host template to use
	host_name               localhost
	alias                   localhost
	address                 127.0.0.1
	address6                ::1
	check_command           check_multi_icinga!'check_host_alive_dualstack.cmd'!'-r 1+2+4+8'
}

Reloading icinga should you show something like this:

Now we have general connectivity of our dualstacked systems monitored.