Page 1 of 1

multiple sites on same address

Posted: Tue Oct 04, 2011 8:59 am
by stu_wat
using check_http to check multiple folders
by stu_wat ยป 04 Oct 2011 12:49

Hi

We have a webserver set up similar to the following:-

www.example.com/site1
www.example.com/site2
www.example.com/site3

How can I check for a string on each of these sites.

I have tried using the

-u and -s arguments on check_http but it only seems to check the last site I specify.

Stuart

Re: multiple sites on same address

Posted: Wed Oct 05, 2011 10:00 am
by mguthrie
Can you post a command-line test of what you're running?

Code: Select all

./check_http -H www.example.com -u /site1 -s "some string"

Re: multiple sites on same address

Posted: Wed Nov 02, 2011 8:11 pm
by agarcia
I'm currently testing nagios and want to monitor specific string on a page. the following commands works but I am not sure which file I need to edit to add this command on nagios. can someone let me know?

./check_http -H 192.168.1.100 -u http://www.abc.com/login.jsp -s "Please sign in:"

HTTP OK: HTTP/1.1 200 OK - 10152 bytes in 0.319 second response time |time=0.318597s;;;0.000000 size=10152B;;;0

Re: multiple sites on same address

Posted: Wed Nov 02, 2011 8:14 pm
by agarcia
Where would you add this command in order to use it as a health check?

Re: multiple sites on same address

Posted: Thu Nov 03, 2011 4:10 pm
by jsmurphy
I think check_http is one of the default commands in commands.cfg:

# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTNAME$ $ARG1$
}

To add it to your host you would create a service that looks like:

define service {
use generic-service
host_name <hostname>
service_description webpage check
check_command check_http!-u http://www.abc.com/login.jsp -s "Please sign in:"
contacts <contacts>
}

Re: multiple sites on same address

Posted: Fri Nov 04, 2011 4:50 pm
by agarcia
I actually just found out that we are using the check_nrpe.

any advice how to do this with the following

./check_http -H 192.168.1.100 -u http://www.abc.com/abc/login.jsp -s "Please sign in:"

another site we have

./check_http -H 192.168.1.101 -u http://www.wzy.com/wxy/login.jsp -s "Please sign in:"

The /abc/ after the url is also needs to be included. This is required since we have multiple sites.

below is the existing check_nrpe config.
command[check_tomcat]=/usr/local/nagios/libexec/check_http -w 4 -c 10 -H localhost
command[check_tomcat_SSL]=/usr/local/nagios/libexec/check_http -w 4 -c 10 -S -H localhost

Re: multiple sites on same address

Posted: Sun Nov 06, 2011 6:17 pm
by jsmurphy
Just stick that in the NRPE config of the server and it should be fine.

command[check_website]=/usr/local/nagios/libexec/check_http -H localhost -u http://www.abc.com/abc/login.jsp -s "Please sign in:"

Ensure that -H is pointing to the right address if it's not on the localhost.