multiple sites on same address

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
stu_wat
Posts: 1
Joined: Tue Oct 04, 2011 8:56 am

multiple sites on same address

Post 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: multiple sites on same address

Post 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"
agarcia
Posts: 3
Joined: Wed Nov 02, 2011 8:01 pm

Re: multiple sites on same address

Post 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
agarcia
Posts: 3
Joined: Wed Nov 02, 2011 8:01 pm

Re: multiple sites on same address

Post by agarcia »

Where would you add this command in order to use it as a health check?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: multiple sites on same address

Post 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>
}
agarcia
Posts: 3
Joined: Wed Nov 02, 2011 8:01 pm

Re: multiple sites on same address

Post 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
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: multiple sites on same address

Post 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.
Locked