{"id":4468,"date":"2019-10-20T13:35:09","date_gmt":"2019-10-20T10:35:09","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4468"},"modified":"2024-03-12T22:06:00","modified_gmt":"2024-03-12T19:06:00","slug":"monitor-ssl-tls-certificates-expiry-with-nagios","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/monitor-ssl-tls-certificates-expiry-with-nagios\/","title":{"rendered":"Monitor SSL\/TLS Certificates Expiry with Nagios"},"content":{"rendered":"\n

Well, assuming you understand the implications of the expired SSL\/TLS certificates,<\/a> let us go through how to monitor SSL\/TLS Certificates Expiry with Nagios. Nagios provides SSL Certificate monitoring and alerting when SSL certificates expiration date draws closer using the Nagios Plugins.<\/p>\n\n\n\n

Before you can proceed, install and setup Nagios server. Follow the links below to setup Nagios server on your desired system.<\/p>\n\n\n\n

Install Nagios Server on CentOS 8<\/a><\/p>\n\n\n\n

Install Nagios Core on Debian 10 Buster<\/a><\/p>\n\n\n\n

Monitoring SSL\/TLS Certificates Expiry with Nagios<\/h2>\n\n\n\n

Once your Nagios server is up and ready proceed to configure it to monitor your web servers SSL\/TLS certificates expiry.<\/p>\n\n\n\n

check_http<\/a><\/strong><\/code> Nagios plugin is used to test the HTTP service on the specified host. It can test normal (http) and secure (https) servers, follow redirects, search for strings and regular expressions, check connection times, and report on certificate expiration times.<\/p>\n\n\n\n

Reporting on certificate expiration times is the main focus of this guide.<\/p>\n\n\n\n

Install Nagios Plugins<\/h3>\n\n\n\n

Nagios plugins provide the check_http plugin script. Below is a sample guide on how to install Nagios plugins on the Nagios server.<\/p>\n\n\n\n

Install Nagios Plugins From Source RHEL\/CentOS\/Oracle Linux<\/a><\/p>\n\n\n\n

Add the Host to Nagios Server<\/h3>\n\n\n\n

Next, you need to add the host whose SSL\/TLS certificates is to be monitored to Nagios Server. See a sample guide below;<\/p>\n\n\n\n

Add Hosts to Nagios Server For Monitoring<\/a><\/p>\n\n\n\n

Create Check_HTTP Command Object Definition<\/h3>\n\n\n\n

Create a command object definition that defines how to use the check_http command to monitor the SSL\/TLS certificates.<\/p>\n\n\n\n

If you compiled Nagios from the source, then create the command definition configuration on \/usr\/local\/nagios\/etc\/objects<\/code>. You can also use your own custom sub-directory, like \/usr\/local\/nagios\/etc\/objects\/kifarunix-demo<\/code>, for our case.<\/p>\n\n\n\n

Be sure to replace PATHS accordingly.<\/strong><\/p>\n\n\n\n

vim \/usr\/local\/nagios\/etc\/objects\/kifarunix-demo\/commands.cfg<\/code><\/pre>\n\n\n\n
# Check SSL\/TLS Certificate Expiry Command Definition<\/strong>\ndefine command{\n    command_name check_certs\n    command_line \/usr\/local\/nagios\/libexec\/check_http -S -I $HOSTADDRESS$ -p $ARG1$ -C $ARG2$\n}<\/code><\/pre>\n\n\n\n