Home Directory

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

Directory

jkegaly

Reviews(2)
byjkegaly, April 2, 2018
This was a good starter script. It works as it should after modification. I ended up modifying it to say...
#######################################
#!/bin/bash
SitePort=$1

OutDate=$(echo | openssl s_client -connect ${SitePort}:443 2>/dev/null | openssl x509 -noout -endda$

OutputDate=$(date -d "${OutDate}" "+%s")
SystemDate=$(date '+%s')

DiffTime=$(expr "${OutputDate}" - "${SystemDate}")

if [ "${DiffTime}" -ge 864000 ]
then
echo "Certificate will expire on ${OutDate}"
exit 0

elif [ "${DiffTime}" -le 863999 -a -ge 5 ]
then
echo "Certificate is going to expire in less then 10 days on ( ${OutDate} ). Please Renew!"
exit 1
elif [ "${DiffTime}" -le 4 ]
then
echo "Certificate has EXPIRED on ( ${OutDate} )! Please replace!"
exit 2
else
echo "ERROR! Certificate NOT found!"
exit 2
fi
#######################################
byjkegaly, April 2, 2018
Works very well, just took the check_http command and modified so it would work properly!