I'm setting up Icinga (Nagios fork) and I have some machines with multiple interfaces. Some services are only listening on one of them and to check them correctly, I like to know if it's possible to have multiple IP addresses configured for a single host in Icinga.
Here's a minimal example:
Remote Server:
- eth0:
1.2.3.4
(public IP) - eth1:
10.1.2.3
(private IP, secure tunnel) - Apache listening on
1.2.3.4:80
. (public only) - OpenSSH listening on
10.1.2.3:22
. (internal network only) - Postfix SMTP listening on
0.0.0.0:25
(all interfaces)
Icinga Server:
- eth0:
10.2.3.4
(private IP, internet access)
Now if I define a host:
define host {
use generic-host
host_name server1
alias server1.gertvandijk.net
address 10.1.2.3
}
This will not check the HTTP status correctly. And defining an additional host:
define host {
use generic-host
host_name server1-public
alias server1.gertvandijk.net
address 1.2.3.4
}
will check everything, but shows up as two independent hosts. Now I want to 'aggregate' these two hosts to show up as a single host, yet providing an easy configuration to check the services on their proper address.
What is the most elegant number-of-configuration-lines-saving solution to this? I read about several plugins available to workaround this, but I can't figure out what is the current way to address it. Solutions go back to 2003, but I'm running Icinga 1.7.1, already capable of the address6
option, yet that triggers IPv6-only resolving on the hostname...
Ideally, I wish to configure Icinga to be intelligent enough to know that the Postfix instance running on 10.1.2.3:25
is the same as 1.2.3.4:25
and thus not triggering two alarms.
I guess this must have been tackled before and sysadmins have it set up now. Please share your solution to this. Thanks! :)
You can define a custom object variable, something like this:
then call it as
$_HOSTWAN_ADDRESS$
macro: