Skip to main content Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Nagios plugin to check certificates on local file system

Published: 24-09-2012 | Author: Remy van Elst | Text only version of this article

❗ This post is over eleven years old. It may no longer be up to date. Opinions may have changed.

This tutorial will show you how you can use the nagios plugin "check ssl cert" to monitor locally stored SSL certificates.

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!

Installing the nagios-plugin

The plugin needs the expect program to be installed on the hosts which will check their certificates.

Install it with the following command:

sudo apt-get install expect

Now install the plugin:

sudo wget -O /etc/nagios-plugins/check_ssl_cert --no-check-certificate

Also, make it executable:

sudo chmod +x /etc/nagios-plugins/check_ssl_cert

Setting up the host

On the nagios client where the certificates are, you have to edit the NRPE config to do the checks locally

vim /etc/nagios/nrpe_local.cfg


command[check_local_ssl]=/etc/nagios-plugins/check_ssl_cert -H localhost -f /home/so_ad/7days.pem -c 30
command[check_local_ssl]=/etc/nagios-plugins/check_ssl_cert -H localhost -f /home/so_ad/7days.pem -c 5    

Setting up the nagios server

I have the hostgroup nodes defined, and in my nagios config file I add the following service:

vim /etc/nagios3/conf.d/services-hostgroups.cfg
Tags: certificates , monitoring , nagios , openssl , software