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
multiple sites on same address
Re: multiple sites on same address
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
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
./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
Where would you add this command in order to use it as a health check?
Re: multiple sites on same address
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>
}
# '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
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
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
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.
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.