Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_http_content
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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).
It has no other dependencies than PERL itself and some libraries (Getopt::Std and LWP::UserAgent, latter with optional SSL support).
Reviews (7)
bygomatze, November 10, 2016
I changed the
as well.
Works! Thumbs up!
as well.
Works! Thumbs up!
bySteveRadich, January 11, 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.
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.
byadarsh, May 30, 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
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
bygdr, June 14, 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
check_command check_http_content!http://64.20.36.132:82/xml!25388C85-A193-47DC-A7-1C-95-EB-92-EC-E9-28!5
byCyber-Wizard, November 13, 2012
Has anyone any suggestions on making this a case-insensitive check?
byCloudmaster, April 9, 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
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
bypydubreucq, September 22, 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 FOUND\n";
With that, when I'm testing in bash it's better display.
Thanks a lot
bye
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 FOUND\n";
With that, when I'm testing in bash it's better display.
Thanks a lot
bye