expiration

Monitoring SSL certificate expiration with Nagios

Hi Lads,

This is a post for nerds so I’m writing it in English. If you don’t understand English or technical stuff please close this page 😀
I’m at work and I’ve just finished to write a Nagios script to monitor expiration date of a SSL certificate.

I wanna share it with you.

To have the script working properly you just need to install OpenSSL and let the openssl
command be in your PATH environment.

This is the usage:

Usage:
check_ssl_cert.sh hostname port [warningdays]

Warning days default value is 30 days.

Some examples:

[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443
OK: Certificate is valid for 289 days expires on May  2 17:02:55 2009 GMT

[afailla@terminus ~]$  /usr/local/nagios/bin/check_ssl_cert.sh google.com 443 400
CRITICAL: Certificate will expire in 289 days on May  2 17:02:55 2009 GMT

Download the script here and enjoy it.