Monitor SSL Certificates w/ CheckMK's Agents
Let’s Encrypt recently sent out a notification indicating that they will be no longer sending email notifications when a certificate is near expiration. For most services this isn’t an issue as I’ve been using CheckMK’s SSL Certificate Check to monitor any certificate directly reachable by CheckMK itself.
But what about services which require an SSL certificate not exposed externally? Or.. the service is exposed externally but you’d prefer not to allow CheckMK direct access to the requisite port just for the sake of monitoring.
Thankfully I ran across the sslcertificates plugin graciously written and provided by Heinlein Support. Using this plugin, I could have the CheckMK agent installed directly on reach host check the certificate and report back the status of the certificate(s).
Here is the installation procedure I followed.
Install ChecKMK Extension
Logon to your CheckMK server and browse to the root of your CheckMK site.
cd /opt/omd/sites/[SITE NAME]
Download the sslcertificates plugin.
wget https://github.com/HeinleinSupport/check_mk_extensions/blob/cmk2.2/sslcertificates/sslcertificates-8.8.0.mkp
Log into OMD, connecting to your site.
sudo omd su [SITE NAME]
Install the plugin and enable it within CheckMK.
mkp add sslcertificates-8.7.2.mkp
mkp enable sslcertificates
Delete the plugin file as its no longer needed.
rm sslcertificates-8.7.2.mkp
Install Agent Plugin
Install the respective script onto each host’s plugins directory. Heinlein Support provides a script to cover both Windows and Linux hosts.
C:\ProgramData\checkmk\agent\plugins
./usr/lib/check_mk_agent/local/
.Service Discovery
Back on CheckMK (via web browser):
- Browse to
Setup >> Service monitoring rules >> Parameters for SSL certificates
. - Create a new rule with your preferred settings for monitoring SSL certificates.
- Lastly, under
Setup >> Hosts
, run a Service Discovery on the affected hosts. Accept the new SSL Certificate service which will appear as a unmonitored service. - Activate the changes.
Thats it! Looking at one our hosts, we now see the SSL certificate(s) being monitored via the CheckMK agent.