Nagios plugin to check an OCSP server

06-05-2013 | Remy van Elst

Table of Contents

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.

Do you need a VPS for hosting nagios? InceptionHosting has very good VPS servers!


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