Anecdotes from a Linux Systems Administrator. /root

Home About Books Blog Portfolio Archive
4 November 2018

Nagios SSL Certificate Expiration Check

by Alpha01

So, a while back I demonstrated a way to to set up an automated SSL certificate expiration monitoring solution. Well, it turns out the check_http Nagios plugin has built-in support to monitor SSL certificate expiration as well. This is accomplished using the -C / --certificate options.

Example check on a local expired Let’s Encrypt Certificate:

[root@monitor plugins]# ./check_http -t 10 -H -I -C 10
SSL CRITICAL - Certificate '' expired on 2018-07-25 18:39 -0700/PDT.

check_http help doc:

-C, --certificate=INTEGER[,INTEGER]
    Minimum number of days a certificate has to be valid. Port defaults to 443
    (when this option is used the URL is not checked.)

CHECK CERTIFICATE: check_http -H -C 30,14

 When the certificate of '' is valid for more than 30 days,
 a STATE_OK is returned. When the certificate is still valid, but for less than
 30 days, but more than 14 days, a STATE_WARNING is returned.
 A STATE_CRITICAL will be returned when certificate expires in less than 14 days
Tags: [ nagios ]