Skip to main content Logo

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

Nagios plugin to check an OCSP server

Published: 06-05-2013 | 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 is a nagios plugin to check an OCSP server. It does so by having either a PEM encoded certificate in the code, and the PEM encoded certificate of the issuer in the code, or by using two given PEM files. This is sent to the OCSP server and the response is then parsed to give the correct nagios result. It is targeted at administrators who have their own OCSP and need to know when it is not working.

This version has contributions from Pali Sigurdsson.

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!


Download the plugin from my github
Download the plugin from



  • -H host_name - remote host to check
  • -P port - port to use
  • --noverify - Don't verify if certificate is valid
  • --max-age 4800 - alert if certificate is about to expire
  • --cert filename - use this cert file instead of the hardcoded one
  • --issuer filename.pem - use this issuer certificate instead of the hardcoded one
  • --verbose - handy for troubleshooting, echos the exact openssl command used


This guide covers the steps needed for Ubuntu 10.04/12.04 and Debian 6. It should also work on other distro's, but make sure to modify the commands where needed (package installation for example).

First make sure you have the required tools:

apt-get install gawk grep bash sed wget curl openssl

Place the script on the nagios host (I've placed it in /etc/nagios/plugins/ ):

wget -O */etc/nagios/plugins/

Make sure that the script is executable:

chmod +x /etc/nagios/plugins/

Now test it:

OK: OCSP up and running - status of certificate for GOOD by OCSP:

Nagios config

Here's some example nagios config:

Lets create a command definition:

define command{
    command_name    check_ocsp
    command_line    /etc/nagios-plugins/ -H $USER1$ -p $USER2$ --cert $USER3$ --issuer $USER4$

And a service check:

define service {
        use                             generic-service
        host_name                       localhost
        service_description             OCSP check of $OCSP for $DOMAIN
        contact                         nagiosadmin                 
        check_command                   check_ocsp!!443!/etc/ssl/certs/raymiiorg.pem!/etc/ssl/certs/comodo.pem

Or if you use a hardcoded certificate:

define command{
    command_name    check_ocsp_hard
    command_line    /etc/nagios-plugins/

define service {
        use                             generic-service
        host_name                       localhost
        service_description             OCSP check of $OCSP for $DOMAIN with hardcoded certificate
        contact                         nagiosadmin                 
        check_command                   check_ocsp_hard
Tags: certificates , dogtag , monitoring , nagios , ocsp , openssl , software , ssl