best way to check one web server w/many vhosts

Greg Vickers g.vickers at qut.edu.au
Thu Mar 4 03:10:53 CET 2004


Daniel,

First, you can't put DNS names into a service check, the host_name 
directive can only have names as defined in a host definition, e.g. the 
host_name declaration in the host definition.

I can give you two methods of doing this:

1. Create a host definition per virtual host, put those hosts into a 
hostgroup and check the hostgroup. That way you will easily see which hosts 
are down in that cluster of virtual hosts (and you can use clustering 
checks etc.)

2. Create a single host that contains the addresses (IP, whatever) of each 
cluster of virtual hosts. e.g.:

define host{
host_name vhostcluster1
address ip1, ip2, ip3 etc
<snip>
}

(But then you will lose the ability in Nagios to do checks on a cluster 
etc.) Then write your service check command so that it knows how to deal 
with multiple addresses being given to it, and ensure that it gives you 
back good information when one of those checks fails.

Both methods will take bit of work, maybe you can script the generation of 
your host definitions (I did for our 1000+ lab computers that we monitor.) 
Or, if you are feeling adventurous, you can look at the second method. I am 
sure that other people here will have other methods you can try.

Greg

At 10:18 AM 04/03/2004, Daniel Finn wrote:
>I'm trying to do something like this and wondering how to do it:
>
>define service{
>         use                             generic-service
>         host_name 
> vhost1.com,vhost2.com,vhost3.com,vhost4.com,vhost5.com,vhost6.com,vhost7.com,vhost8.com,vhost9.com,vhost10.com
>         service_description             Vhost-HTTP
>         is_volatile                     0
>         check_period                    24x7
>         max_check_attempts              3
>         normal_check_interval           3
>         retry_check_interval            1
>         contact_groups                  linux-admins
>         notification_interval           120
>         notification_period             24x7
>         notification_options            w,u,c,r
>         check_command                   check_http!192.168.0.1
>         }
>
>so multiple vhosts on one IP, I would like to check the IP to ensure it's
>answering for each vhost.  Unfortunately when I tried to do it like this
>nagios complained that :
>
>Error: Could not find host 'vhost1.com'
>Error: Could not expand hostgroups and/or hosts specified in service
>
>I would really like to not have to add a host entry for each one of these
>hosts.  There are only 10 in the example but in my real environment there
>are hundreds.  What's the best way to do this?
>
>Thanks
>
>
>Dan Finn
>Unix System Administrator
>Twelve Horses North America
>Cell : 775.233.1774
>Desk : 775.337.3336
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: IBM Linux Tutorials
>Free Linux tutorial presented by Daniel Robbins, President and CEO of
>GenToo technologies. Learn everything from fundamentals to system
>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
>_______________________________________________
>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

=================================
Greg Vickers
Computer Systems Officer
Student Support and Systems,
Teaching and Learning Support Systems,
Queensland University of Technology,
Kelvin Grove Campus,
Brisbane,
Australia

CRICOS No 00213J

Ph: 07 3864 8276 Fax: 07 3864 5425
Mob: 0416 001 674 SD: #66147 



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
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