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

check_https

Rating
4 votes
Favoured:
1
Current Version
0.4
Owner
Hits
152677
Files:
FileDescription
check_httpscheck_https
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Simply check https host .
It checks if a website runs on https, without checking the certificate.

Usage:

./check_https www.example.com

Optional: port number

./check_https www.example.com 444

CHANGELOG on v0.4:

add timeout
Reviews (4)
I added $path_uri so the script can check URL like https://www.example.com/WebService/Service.svc

# ./check_https www.example.com 443 WebService/Service.svc


# my PID
mypid="$$"
html_tmp="/tmp/tmp_html.$mypid"
rep_tmp="/tmp/tmp_rep.$mypid"
add_uri='https://'
path_uri=''
end_uri='/'
PORT=''
exit_code=2

if [ $# -lt 1 ]
then
echo "Arguments are missing! Run ./check_https IP_or_DNS port (optional) "
echo "Eg: ./check_https mywebsite.com"
echo "Eg: ./check_https ::ffff:192.168.1.1 444"
exit 1
fi

if [ $# -gt 1 ]
then
PORT=:$2
fi

# For https://www.example.com/WebService/Service.svc
# path_uri is WebService/Service.svc

if [ $# -gt 2 ]
then
path_uri=:$3
fi

# Give some brain to this script. Detect yourself if we are checking an hostname, an ipv4 or an ipv6


if ipcalc -sc4 $1
then
target=ipv4
else if ipcalc -sc6 $1
then
target=ipv6
else
# we consider here cases in which the passed argument is DNS name
target=DNS
fi
fi

if [ ! "$target" == "ipv6" ]
then
/usr/bin/wget --timeout=10 --no-check-certificate --output-document=$html_tmp -S $add_uri$1$PORT$end_uri$path_uri 2> $rep_tmp
else
/usr/bin/wget --timeout=10 --no-check-certificate --output-document=$html_tmp -S $add_uri[$1]$PORT$$end_uri$path_uri 2> $rep_tmp

fi
Should check ipcalc is installed.

Should redirect ipcal in error to test ip addres:

if ipcalc -sc4 $1 > /dev/null 2>&1
not
if ipcacl -sc1 $1
byjkegaly, April 2, 2018
Works very well, just took the check_http command and modified so it would work properly!
byRogerSik, June 11, 2016
1 of 1 people found this review helpful
Works good with IPv4 addresses.

With IPv6 addresses i get the error:

Generic error code.
Owner's reply

Hi RogerSik,

i submitted a new version with IPv6 support!