Websites, Forms and Transactions

check_http_content

Description:

check_http_content is a web content monitor written in perl. Checks a URL for specific text.

Current Version

Last Release Date

June 22, 2009

Compatible With


Project Files
Project Notes
It retrieves an URL through http or https and looks in its output for a given text. If the text is found returns OK, if not found returns CRITICAL plus the last line of text received (and the full text as additional output data), and UNKNOWN otherwise (connection error,...) plus a brief error description. It has no other dependencies than PERL itself and some libraries (Getopt::Std and LWP::UserAgent, latter with optional SSL support).
Reviews (7) Add a Review
Works great
by gomatze, November 30, 2016
I changed the
as well.
Works! Thumbs up!
Helpful? Yes  No 
Good, but after a change met my needs better..
by SteveRadich, January 31, 2016
I added stripping the HTML:

in the use section:

use HTML::FormatText;

my @output_lines = split(/
/, $content);
# print "CONTENT ERROR: EXPR NOT FOUND (last: $output_lines[$#output_lines])
full output was:
$content";
my $text = HTML::FormatText->format_from_string($content);
print "CONTENT ERROR: EXPR NOT FOUND:
";
print "$text
";
$status = EXIT_CRITICAL;

With this change I found it more useful output for my client.
Helpful? Yes  No 
RE: Cloudmaster
by adarsh, May 31, 2015
@Cloudmaster,

You missed the quotes. Your check_command supposed to be

check_command check_http_content -U http://64.20.36.132:82/xml -m "25388C85-A193-47DC-A7-1C-95-EB-92-EC-E9-28" -t 5

Thanks,
Addy
Helpful? Yes  No 
Re: Cloudmaster
by gdr, June 30, 2013
@Cloudmaster you probably already figured it out but just in case, in service definition it should be as following:

check_command check_http_content!http://64.20.36.132:82/xml!25388C85-A193-47DC-A7-1C-95-EB-92-EC-E9-28!5
Helpful? Yes  No 
Case Insensitive?
by Cyber-Wizard, November 30, 2012
Has anyone any suggestions on making this a case-insensitive check?
Helpful? Yes  No 
Don't know where to post this so...
by Cloudmaster, April 30, 2012
Need a bit of handholding -

This is what I have in my commands.cfg -

define command{
command_name check_http_content
command_line $USER1$/check_http_content -U $ARG1$ -m $ARG2$ -t $ARG3$
}

This is what's in my host.cfg -

define service{
use generic-service
host_name Air SeaTac
service_description FSHost 2002
servicegroups front_end_services
check_command check_http_content -U http://64.20.36.132:82/xml -m 25388C85-A193-47DC-A7-1C-95-EB-92-EC-E9-28 -t 5
notifications_enabled 1
}

This is what happens when I run check_http_content manually -

[root@prometheus libexec]# ./check_http_content -U http://64.20.36.132:82/xml -m 25388C85-A193-47DC-A7-1C-95-EB-92-EC-E9-28 -t 5
CONTENT OK: EXPR FOUND[root@prometheus libexec]#

Trying to restart Nagios after config changes results in error
Helpful? Yes  No 
Works Fine
by pydubreucq, September 30, 2011
Hi,
This script works fine ;)
I've just modified a little on line 67 and add "n"
The original line :
print "CONTENT OK: EXPR FOUND";
The modified libne :
print "CONTENT OK: EXPR FOUNDn";
With that, when I'm testing in bash it's better display.
Thanks a lot
bye
Helpful? Yes  No 
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.7 (9)
Favorites
0
Views
157,795