Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
nagios-check-website
0.1
2013-11-28
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
MIT
170423
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 website accessibility by return code and execution time.
- specific URL support
- ssl option
- alternative port
- fake user agent
- proxy as parameter
- proxy from environment variable
Usage: check_website [OPTIONS] {HOSTNAME}
{HOSTNAME}
host to check (dns/ip)
[OPTIONS]:
-p PORT port to check (default: 80)
-u URL url path (default: /)
-f use fake agent (windows xp/firefox 25)
-s use SSL via HTTPS (default: 443)
-P PROXY proxy access (hostname:port)
-w WARNING warning threshold in milliseconds (default: 500)
-c CRITICAL critical threshold in milliseconds (default: 2000)
-n TRIES number of times to try (default: 1)
-t TIMEOUT amount of time to wait in seconds (default: 10)
Examples:
$ ./check_website www.google.com
HTTP OK: 174ms - http://www.google.com/|time=174ms;500;2000;0;
$ ./check_website -f www.amazon.com
HTTP WARNING: 740ms - http://www.amazon.com/|time=740ms;500;2000;0;
$ ./check_website -p 8080 -u /index.html -s -P 192.168.27.111:3128 -c 4000 -w 1500 www.myweb.com
HTTPS OK: 274ms - https://www.myweb.com:8080/index.html|time=274ms;1500;4000;0;
- specific URL support
- ssl option
- alternative port
- fake user agent
- proxy as parameter
- proxy from environment variable
Usage: check_website [OPTIONS] {HOSTNAME}
{HOSTNAME}
host to check (dns/ip)
[OPTIONS]:
-p PORT port to check (default: 80)
-u URL url path (default: /)
-f use fake agent (windows xp/firefox 25)
-s use SSL via HTTPS (default: 443)
-P PROXY proxy access (hostname:port)
-w WARNING warning threshold in milliseconds (default: 500)
-c CRITICAL critical threshold in milliseconds (default: 2000)
-n TRIES number of times to try (default: 1)
-t TIMEOUT amount of time to wait in seconds (default: 10)
Examples:
$ ./check_website www.google.com
HTTP OK: 174ms - http://www.google.com/|time=174ms;500;2000;0;
$ ./check_website -f www.amazon.com
HTTP WARNING: 740ms - http://www.amazon.com/|time=740ms;500;2000;0;
$ ./check_website -p 8080 -u /index.html -s -P 192.168.27.111:3128 -c 4000 -w 1500 www.myweb.com
HTTPS OK: 274ms - https://www.myweb.com:8080/index.html|time=274ms;1500;4000;0;
Reviews (5)
byarendon, March 5, 2020
Hi!
I have my command like this and it indicates that the port is invalid.
I share my scrip
define service {
use generic-service ; Inherit default values from a template
host_name RCIEF_EXTERNOS
service_description HTTP
check_command check_http!192.168.105.09 :17000/CR_RCIEF/faces/Units/Login.jsp
define command {
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ -p $_SERVICEport_number$ -u -A $ARG1$
}
Help me
I have my command like this and it indicates that the port is invalid.
I share my scrip
define service {
use generic-service ; Inherit default values from a template
host_name RCIEF_EXTERNOS
service_description HTTP
check_command check_http!192.168.105.09 :17000/CR_RCIEF/faces/Units/Login.jsp
define command {
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ -p $_SERVICEport_number$ -u -A $ARG1$
}
Help me
bynishith, September 10, 2017
Here is my commands.cfg file:
check_website -H $HOSTADDRESS$ $ARG1$
My service Monitoring Command is,
check_website "www.example.com/login.aspx"
It gives HTTP OK Message in Nagios Web Frontend.
check_website -H $HOSTADDRESS$ $ARG1$
My service Monitoring Command is,
check_website "www.example.com/login.aspx"
It gives HTTP OK Message in Nagios Web Frontend.
bymoetteli, September 26, 2014
Hi,
Thanks for the script.
It was though only working on the CLI and not in Nagios, until I found out, that somehow there was the a wrong current working directory defined. So WGet tried to save into that non-writeable working directory and failed and the whole script returned state 'UNKNOWN'.
It was enough to just add
-P /tmp
to the wget call.
Thanks for the script.
It was though only working on the CLI and not in Nagios, until I found out, that somehow there was the a wrong current working directory defined. So WGet tried to save into that non-writeable working directory and failed and the whole script returned state 'UNKNOWN'.
It was enough to just add
-P /tmp
to the wget call.
Hello,
My conf in commands.cfg is:
url
define command{
command_name check_website
command_line $USER1$/check_website.sh www.globo.com
The status in service detail of url nagios is:
UNKNOWN 06-11-2014 14:08:23 0d 0h 33m 15s 3/3 HTTP UNKNOWN: N/A - http://www.globo.com/
Do not know why the status is UNKNOWN. It should be OK as the other.
On the command line is ok:
/usr/local/nagios/libexec/check_website.sh www.globo.com
HTTP OK: 234ms - http://www.globo.com/|time=234ms;500;2000;0;
Can you help me?
My conf in commands.cfg is:
url
define command{
command_name check_website
command_line $USER1$/check_website.sh www.globo.com
The status in service detail of url nagios is:
UNKNOWN 06-11-2014 14:08:23 0d 0h 33m 15s 3/3 HTTP UNKNOWN: N/A - http://www.globo.com/
Do not know why the status is UNKNOWN. It should be OK as the other.
On the command line is ok:
/usr/local/nagios/libexec/check_website.sh www.globo.com
HTTP OK: 234ms - http://www.globo.com/|time=234ms;500;2000;0;
Can you help me?
Hello,
Can you help me. What I must write in section "define service"? If I write it:
check_command check_website! -P 203.146.82.253 -w 20000 -c 50000 www.name.com - it is work not correctly.
In the commands.cfg I wrote it:
command_line $USER1$/check_website.sh -P $ARG1$ -w $ARG2$ -c $ARG3$ $HOSTADDRESS$
If I try to run this script
/usr/lib/nagios/plugins/check_website.sh -p 80 -u /index.html -P 203.146.82.253 -w 22000 -c 50000 www.name.com - all work!
Can you help me. What I must write in section "define service"? If I write it:
check_command check_website! -P 203.146.82.253 -w 20000 -c 50000 www.name.com - it is work not correctly.
In the commands.cfg I wrote it:
command_line $USER1$/check_website.sh -P $ARG1$ -w $ARG2$ -c $ARG3$ $HOSTADDRESS$
If I try to run this script
/usr/lib/nagios/plugins/check_website.sh -p 80 -u /index.html -P 203.146.82.253 -w 22000 -c 50000 www.name.com - all work!
Owner's reply
Hello Ivani,your proxy definition is missing the port number.
It works on the cli since you probably have a defined proxy environment value which is used in favor of the passed argument.
Try to use 203.146.82.253:3128 if that is your proxy ip and service port.
My script is lacking in argument checking. I'll have to fix that.