Hey mguthrie,
Sorry about posting soo many time in a row before you come back with a reply. But I thought it be best to keep updated where I am at so you don't answer something that I already am passed.
I downloaded this module for Perl called Perl::PrefSuf, you might already know what it is.
But if you don't its a Perl Module that simply takes a string of words you give it and builds a REGEX for that exact string of words.
So I made a little test script and copied the string I wanted to find exactly as it is in the code, and pasted it into the script. Below the script is the regular expression that it generated:
**The Comapny Name is actually
"J.W. Pepper & Son, Inc."
PreSuf Script:
Code: Select all
#!/usr/bin/env perl
use strict;
use warnings;
use Regex::PreSuf;
# Put in the words you want to match here
my @words = qw( Copyright ©
J.W. Pepper & Son, Inc. );
my $re = presuf( @words );
print "$re\n";
REGEX Generated From Script Output:
Code: Select all
(?:Copyright|Inc\.|J\.W\.|Pepper|Son\,|\&(?:amp|copy)\;)
Then I tried using that REGEX it gave me exactly as it is and put it into the command, and get a bash error. Output below:
Code: Select all
./check_http -H 192.168.4.100 -u /sheet-music/welcome.jsp -c 15 -l -r (?:Copyright|Inc\.|J\.W\.|Pepper|Son\,|\&(?:amp|copy)\;)
-bash: syntax error near unexpected token `('
So I then removed the "( )" parenthesis and added ' ' single-quotes. Output below:
Code: Select all
./check_http -H 192.168.4.100 -u /sheet-music/welcome.jsp -c 15 -l -r '?:Copyright|Inc\.|J\.W\.|Pepper|Son\,|\&(?:amp|copy)\;'
Could Not Compile Regular Expression: Invalid preceding regular expressioncheck_http: Could not parse arguments
Finally I kept the single-quotes but this time removed both of the "?:" (question-marks and colons). Output below:
Code: Select all
./check_http -H 192.168.4.100 -u /sheet-music/welcome.jsp -c 15 -l -r 'Copyright|Inc\.|J\.W\.|Pepper|Son\,|\&(amp|copy)\;'
HTTP OK: HTTP/1.1 200 OK - 90097 bytes in 0.015 second response time |time=0.015230s;;15.000000;0.000000 size=90097B;;;0
So I guess I'm wondering if this worked correctly? Because I tried a REGEX in the Nagios command and in the middle of the string to match I added a word that is not on the page and it still came back with an "HTTP OK"? Let me know what your thoughts are... Thanks again.
Thanks,
Matt