Jump to content

Nagios Plugin for SSL Certificate expiry Checks

From TetraWiki
Revision as of 11:23, 25 October 2013 by Biswajit (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Nagios Plugin for SSL Certificate expiry Checks

Nagios should be enabled to check SSL certificate expiry dates remotely and alert on the time remaining if it is less than 30 days or so

Download

http://exchange.nagios.org/directory/Plugins/Network-Protocols/HTTP/check_ssl_cert/details

Installation

Copy the check_ssl_cert ( nagios Plugin ) in /usr/local/nagios/libexec/ directory

make it executable and owned by nagios user

chmod 755 /usr/local/nagios/libexec/check_ssl_cert
chown nagios.nagios /usr/local/nagios/libexec/check_ssl_cert

Then check an site / zimbra admin which has ssl certificate with command line , example for Zimbra internal certificate is shown below

/usr/local/nagios/libexec/check_ssl_cert -H webmail.phdcci.in -A -p 7071

you will get a response like

SSL_CERT OK - X.509 certificate for 'webmail.phdcci.in' from 'webmail.phdcci.in' valid until May  3 15:58:02 2014 GMT

This gives the expiry date too. ( -A option is for not to check valid authority , -p is for specifying the port address )

Now , Please create a command for nagios in /usr/local/nagios/etc/objects/command.cfg as shown below

define command {
      command_name                             check_ssl_certificate_expiry
      command_line                             $USER1$/check_ssl_cert -H $HOSTADDRESS$ -A -p $ARG1$
}

Reload the nagios with

service nagios reload

Configuration

Now you are ready to configure services to check the ssl expiry . So add the following line in the host/service configuration files of the concerning hosts

define service {
              use                      generic-service
              host_name                webmail.phdcci.in
              service_description     SSL Certificate Expiry
              notification_options    w,u,c,r
              check_command            check_ssl_certificate_expiry!7071
             }

Reload the Nagios service .

Check the environment on the web GUI of Nagios