Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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! :)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can define a custom object variable, something like this:

define host {
        use                     generic-host
        host_name               server1
        alias                   server1.gertvandijk.net
        address                 10.1.2.3
        _wan_address            1.2.3.4
        }

then call it as $_HOSTWAN_ADDRESS$ macro:

define command{
        command_name    check_wan_http
        command_line    $USER1$/check_http -I $_HOSTWAN_ADDRESS$ $ARG1$
        }

define service{
    use                     generic-service
    hostgroup_name          apache
    service_description     Apache
    check_command           check_wan_http
    process_perf_data       0
    contact_groups          admin
}
share|improve this answer
    
You might want to call it something like '__wan_address' to use it as $_HOST_WAN_ADDRESS$, for readabily. Some people find that appealing. –  Keith Sep 27 '12 at 21:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.