Load Balanced Website

Marc Powell marc at ena.com
Tue Sep 9 20:27:42 CEST 2008


On Sep 9, 2008, at 12:53 PM, Chris Stolworthy wrote:

> Hey everyone,
>
> I have been looking but I can’t seem to find an article that deals  
> specifically with my problem.  I have 2 servers (lets say  
> 192.168.1.10,192.168.1.20)  they both have the same website on them  
> and they are load balanced. I would like to specifically check that  
> the website on 192.168.1.10 is up and then check that the website on  
> 192.168.1.20 is up as well.  I can get it to work by putting in the  
> url testing.test.com, but I cannot seem to get anything working with  
> a specific url.  I assume that the check_http module can handle  
> this, but I am not sure how to configure it.

Create a host{} definition for each server --

define host {
	host_name	webserver_1
	alias		Tasty Server 1
	address		192.168.1.10
	...
}
(repeat)

Create a service definition associated with each server --

define service {
	host_name	webserver_1
	service_description	My Happy Balanced Site
	check_command		check_http_url!testing.test.com!/path/to/check
	...
}
(repeat)

Create a command definition that allows for dynamic v1.1 host header  
and url path (suitable for use for other websites) --

define command {
	command_name		check_http_url
	command_line		$USER1$/check_http -I $HOSTADDRESS$ -H $ARG1$ -u $ARG2$  
-w 20 -c 30 -t 45
}

Explanation --

For each host, check_http will (check_http --help) --

check the webserver listening on the host
	-I, --IP-address=ADDRESS IP address or name (use numeric address if  
possible to bypass DNS lookup).
ask for the virtual host 'testing.test.com'
	-H, --hostname=ADDRESS Host name argument for servers using host  
headers (virtual host)
and the path '/path/to/check'
	-u, --url=PATH URL to GET or POST (default: /)
WARNING if it takes longer than 20 seconds
	-w 20
CRITICAL if it takes longer than 30 seconds
	-c 30
timeout if all else fails in 45 seconds
	-t 45

You'll get an alert if either is down. If you want to test if the site  
is completely unavailable, the check_cluster plugin would be the way  
to go combined with the above.

--
Marc


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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