Many ip's in one host

Stefan Giesen Stefan.Giesen at firstgate.de
Fri Oct 8 18:19:16 CEST 2004


Am Fr, den 08.10.2004 schrieb Gerd Müller um 17:26:
> Am Fr, den 08.10.2004 schrieb victor um 17:13:
> > How?
> > Can you give me an example?
> > I see that at service definition I can't specify a ip address(ip 
> > addresses are only at hosts).
> [...] 
> and than on the host's services define a service per each ip:
> 
> define service {
>         use                             generic-service
>         host_name                       multi-homed
>         service_description             ping eth0
>         check_command                   check_ip_ping!192.168.1.1
>         }

There is an elegant alternative for this, assuming you've the following
(common) setup:

1. Two interfaces for the host in different networks (e.g. 10.10.10.10
and 10.20.20.10)
2. One dummy interface (to which the DNS entry points and which is e.g.
announced via RIP, as in "myhost.mynet.local IN A 192.168.0.10").

Then you can modify your "normal" check commands to use the $HOSTNAME$
instead the $HOSTADDRESS$, e.g.:

# 'check_telnet' command definition
define command{
        command_name    check_telnet
        command_line    /usr/lib/nagios/plugins/check_tcp -H $HOSTNAME$
-p 23
        }

Then you set the HOSTADDRESS entry for this host to both IP addresses,
seperated by spaces or commas (depends on how your check command works,
see below), a sample host entry would look like this:

define host{
        use                     linux-host           ; template to use
        check_command           check-host-multiple-alive
        host_name               myhost.mynet.local
        address                 10.1.1.10,10.2.2.10
        alias                   My Server
        }

The corresponding check command should look like this:

# 'check-host-multiple-alive' command definition
define command{
        command_name    check-host-multiple-alive
        command_line    /path/to/my/own/new/check_mping $HOSTADDRESS$
        }

"check_mping" has to be a script/programm which is able to ping multiple
IP adresses and give the corresponding return values for nagios (maybe a
wrapper script for the standard "ping" command which should issue a
WARNING if one of the interfaces goes down and an ERROR if both aren't
reachable).

The biggest advantage which this solution is that you can have other
checks which also use both IP addresses as well as checks for the
virtual host adddress which can be reached over both interfaces (e.g.
the webserver running on that machine). Beside that you don't have
thousands of service checks just for the second IP address on every
host, so your monitoring pages are still compact. And not to forget that
your monitoring is much better tunable regarding notifications if just
one interface goes down (maybe you don't want to be waked up in the
night because of just one interface failing - while the server itself
ist still up, running and reachable via the other one). If you've an
extra service for each IP address, you've to use check_cluster or
similar to get the same flexibility.

Regards,
Stefan Giesen
-- 
Stefan Giesen, Systemadministration Frankfurt
FIRSTGATE Internet AG, Im MediaPark 5, 50670 Koeln
Telefon: +49 (0) 2 21 / 45 45-745, Telefax: +49 (0) 2 21 / 45 45-710
Internet: www.firstgate.de         eMail: Stefan.Giesen at firstgate.de



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list