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 website response

Rating
12 votes
Favoured:
2
Current Version
1.1
Last Release Date
2012-05-24
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
188295
Files:
FileDescription
check_website_response.shCurrent Release: v1.1
check_website_response_v1.0.shPrevious Release: v1.0
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!
This plugin is used to monitor website up time and response time.

Error codes will be returned if the website is not responding, the URL does not contain data, does not resolve, or responds slower than specified with the warning and critical input options.

Usage: check_website_response.sh -w (warning milliseconds) -c (critical milliseconds) -u (url) [ -nocert ]

This script has the following dependencies - netcat, date, wget, echo, awk, tr and cksum.

commands.cfg needs to contain something like the following:

# 'check_website_response' command definition
define command{
command_name check_website_response
command_line $USER1$/check_website_response.sh -u $ARG1$ -w $ARG2$ -c $ARG3$
}

Called with the following command:

check_command check_website_response!"http://www.domain.com/index.html"!1000!2000

This script will work on POSIX systems has been tested with the Dash shell in Linux Debian and Nagios core 3.2.1

To use the --no-check-certificate option configure as follows:

command_line $USER1$/check_website_response.sh -u $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$

check_command check_website_response!"http://www.domain.com/index.html"!3000!4000!-nocert
Reviews (7)
byamol.ac, June 24, 2015
I t works great ! Thanks !
byTony-Caffe, July 1, 2013
I made a few changes since I have a Load Balancer for my 7 webservers and wanted to apply the links to multiple URLs. I added checks but changed service this way:

define service{
host_name web2,web3,web4,web5,web6
service_description blog.website.com
check_command check_nrpe!check_website_response_blog

This was it will check the local web server and then on the local web server I added this:

command[check_website_response_blog]=/usr/lib64/nagios/plugins/check_website_response.sh -u http://blog.website.com/?web2 -w 200 -c 200

Now when a web site goes down it tells me what server its on and that I use "/?web2" to force to use a server instead of letting load balancer decide. Very good tool.

Thank you.
byTrevThorpe, October 23, 2012
One of those simple things that is simple to add in, and just works.

Had to modify the NETSTAT variable to work with my linux release... trivial.

Exellent, thanks.
bysymmetry, April 17, 2012
1 of 1 people found this review helpful
Great add-on works well although I cannot get it to work with a non standard HTTP or HTTPS webpage running on TCP port other than 80 or 443.
Does anyone know if its possible to alter part of the code so I can monitor other ports.
Sorry am a bit of a noob so don't know much coding.
Owner's reply

Hi Symmetry, just add the port to your URL i.e. -u www.google.com:99

dears all;
i need help on how to use this with services.cfg, what would be the host_name??
any idea
bypydubreucq, September 21, 2011
Hi,
This script works fine for us too.
And the patch works fine too and it's compatible with Centreon
Bye
bydkwiebe, August 30, 2011
3 of 3 people found this review helpful
This script works very well for us. There's one minor tweak that can make it more useful. This patch will allow you to output performance data that you can log using pnp4nagios.

Change line 157 from
$ECHO "RESPONSE: $STATUS - $OUTMSG"
to
$ECHO "RESPONSE: $STATUS - $OUTMSG""|Response="$TIMEDIFF"ms;"$WARN";"$CRIT";0"