Page 1 of 1

check_http string search problem

Posted: Fri Feb 06, 2015 1:15 pm
by rickwilson7425
I am trying to make sure that when I use either the -s or -R option with check_http I don't get a false positive return. My main concern is where I am looking for "0 CDM errors" on a page but there is the possibility that there might be "10 CDM errors", in which case it will still find the "0 CDM errors" string and return a false OK.

Can anyone tell me of a way to mitigate this situation?

Thanks

Re: check_http string search problem

Posted: Fri Feb 06, 2015 1:57 pm
by tgriep
Is there a space before the 0 CDM errors message? If so, try adding a space before the 0 in the testing string. See below

Code: Select all

" 0 CDM errors"

Re: check_http string search problem

Posted: Fri Feb 06, 2015 2:14 pm
by rickwilson7425
Unfortunately I don't think that will work. This is what the page looks like:

0 CDM errors detected

Cloud Data Management Publishing Service
Cloud Data Publishing Service version: 2.1.0.176
Cloud Data Publishing Service build date: 2015-01-20 10:57:22 -0700
Cloud Data Publishing Service built by: cdmbuild
Current Time: 2015-02-06T19:03:46Z
Bamboo Status: Passed
Bamboo Timing: 0.0817s
Perforce Status: Passed
Perforce Timing: 0.0076s
Publishing Progress Check: Passed
Publishing Progress Timing: 3.6559s

Re: check_http string search problem

Posted: Fri Feb 06, 2015 3:14 pm
by abrist
Well, is there any markup? check_http checks the entire returned html, so if there is markup, it would act like a "beginning of line" for that html element. You can see what check_http is applying the regex to with "-vvv":

Code: Select all

./check_http -H <hostname> -vvv
In my example below, "Nagios XI" is actually wrapped in a <title> tag, so the command looks like:

Code: Select all

./check_http -H localhost -r '<title>Nagios XI'
Edit:
Also, can you try using the following expression in your command?

Code: Select all

-r "[^1-9]0 CDM errors"
lmiltchev

Re: check_http string search problem

Posted: Fri Feb 06, 2015 3:27 pm
by rickwilson7425
-R "[^1-9]0 CDM errors"

looks like it will work.

Thanks a lot.