Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_http_curl.sh

Rating
0 votes
Favoured:
0
Current Version
0.1a
Last Release Date
2015-05-28
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
11462
Files:
FileDescription
check_http_curl.shcheck_http_curl.sh
Nagios CSP

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!
check_http_curl.sh
This script connects to a site via curl and searches for a string in the web page.
If the string is not found it throws out an error and Nagios exit is set to 'critical'.
Save plugin in $USER1$ dir, in my case (Ubuntu 12.04) it is:
/usr/lib/nagios/plugins
and make it executable.

Command definition:

/etc/nagios3/commands.cfg:
...
# Check HTTP
define command{
command_name check_http_curl
command_line $USER1$/check_http_curl.sh $HOSTNAME$ $HOSTNOTES$
}

Hosts definition:
$HOSTNOTES$ is the string that the plugin will search in the web page source.

/etc/nagios3/conf.d/generic-host_nagios2.cfg
...
define host{
host_name www.site1.org
checks_enabled 0
use generic-host
notes https://www.facebook.com/site1
}

define host{
host_name www.site2.org
checks_enabled 0
use generic-host
notes info@site2.org
}

Group definition:

/etc/nagios3/conf.d/hostgroups_nagios2.cfg
...
# Web Sites
define hostgroup {
hostgroup_name web-sites
alias Web Sites
members www.site1.org,www.site2.org
}

Service definition:

/etc/nagios3/conf.d/services_nagios2.cfg
...
define service {
hostgroup_name web-sites
service_description WWW
check_command check_http_curl
use generic-service
notes Check if site is really down.
}