I was wondering if I could get some help with monitoring text on a website. I.E. If I wanted to monitor google.com for the text "Privacy", I thought I would use the following command:

check_http -H google.com -u http://www.google.com -s "Privacy"

But it is not working. I get "OK" no matter what I put in quotes. I am obviously using either the wrong command or wrong option. Please Help.


Try leaving put the -u. -u gives the path (page) to retrieve, default is "/", it doesn't take the entire URL. Here is my output when I leave it out.

$ ./check_http -H www.google.com -s "Privacy"
HTTP OK HTTP/1.0 200 OK - 0.041 second response time |time=0.040579s;;;0.000000 size=5257B;;;0
$ ./check_http -H www.google.com -s "Privacyblahdibla"
HTTP CRITICAL - string not found|time=0.048169s;;;0.000000 size=5257B;;;0

If you want to get a specific page, use the -u like this

$ ./check_http -H www.google.com -u "/ig" -s "Privacy"
HTTP OK HTTP/1.0 200 OK - 0.166 second response time |time=0.165896s;;;0.000000 size=87843B;;;0
  • I'm still having a problem with my actual website that I am attempting to monitor, this is what I get ./check_http -H mysite.myschool.edu -u "/cp/home/displaylogin" -s "dsklajfdl" HTTP OK - HTTP/1.1 302 Found - 0.003 second response time |time=0.003486s;;;0.000000 size=104B;;;0
    Jul 2 '09 at 16:03
  • Or another example is ./check_http -H mysite.myschool.edu -u "/index.html" -s "dsklajfdl" HTTP OK - HTTP/1.1 302 Found - 0.003 second response time |time=0.003466s;;;0.000000 size=94B;;;0
    Jul 2 '09 at 16:11
  • Yes, it seems that if a redirect (301 or 302) is the response that the check ignores the search string, which is probably correct. The answer is to find the exact url that you are being redirected to. You should be able to do that by going to the page in a browser. If that doesn't work, try accessing it via telnet to see what the Locaction: header value is.
    – palehorse
    Jul 2 '09 at 17:10

Another option is to use the check_curl from monitoringexchange.org. In reality this is a titch too complicated for what you are trying to do, but I have found it extends the functinality when you need it for parsing data from websites and inserting input

Contents of my customized non-variable check_curl below:


 $PROG -k -s http://www.google.com > $FILE

 STATUS=`grep Error $FILE | awk '{ print $0 }'`

 grep -w $HALT $FILE > /dev/null
 if [ $? -eq 0 ]
      WORKING=`grep Privacy $FILE | awk '{ print $5 }'`
      echo "Works, Returns data of $WORKING"
      rm $FILE
 else echo "Doesn't return $WORKING"| $STATUS"
      exit 2


We wrote a custom perl script using LWP and HTML::Tree to search for particular strings. We also just md5sum some pages where the content doesn't change.

  • 1
    I myself am happy with check_http but if you're suggesting this method as a solution, perhaps provide the perl script?
    – Pricey
    Feb 8 '11 at 14:36

If I get a problem like this with the check_http plugin, I usually wget the URL I'm looking for the text in and then examine the output.

If you want something that does a bit more than check_http, such as logging into a web site or checking more than one string, have a look at WebInject - it's a nice plugin.


You need to specify the -e option for the -s option to have the desired effect:

$ ./check_http -H "www.eurocarparts.com" -u / -s "no such string"
OK - HTTP/1.1 302 Found - 0.476 second response time |time=0.475776s;;;0.000000 size=17701B;;;0

$ ./check_http -H "www.eurocarparts.com" -u / -s "no such string" -e 302
CRITICAL - string not found|time=1.633004s;;;0.000000 size=17701B;;;0

$ ./check_http -H "www.eurocarparts.com" -u / -s "0870" -e 302
HTTP OK HTTP/1.1 302 Found - 4.032 second response time |time=4.032120s;;;0.000000 size=17701B;;;0

Here are a couple of checks I use.

The first looks for the text CCServerService and reports an error if it doesn't see it:

define command {
    command_name  check_cc_v5
    command_line  /usr/local/nagios/libexec/check_http -H $HOSTADDRESS$ -p 8080 -u /CCServer/CCServer --regex=CCServerService -w 3 -c 5 -t 10

The second checks for the text error and reports an error if it sees it:

define command {
    command_name  check_wb_pps
    command_line  /usr/local/nagios/libexec/check_http -S -H $HOSTADDRESS$ -u /onlinestore/booking.php --regex=error --invert-regex -w 30 -c 60 -t 90

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.