Module: monitoring-plugins
    Branch: master
    Commit: 2ce22968427ce3cadf5214bda659098032f86efd
    Author: Matthias Hähnel <github....@drhaehnel.de>
 Committer: Sven Nierlein <s...@nierlein.de>
      Date: Mon Apr 20 09:26:59 2015 +0200
       URL: 
https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=2ce2296

Update sslutils.c

optimize output if certificate expires in less then 24h
thx to axel.schmalow...@sixt.com for this patch

---

 plugins/sslutils.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index d0ae474..69d12f2 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -221,6 +221,13 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int 
days_till_exp_crit){
                        return STATE_WARNING;
                else
                        return STATE_CRITICAL;
+        } else if (days_left == 0 && time_left > 0) {
+                int hours_left = (int) time_left/3600;
+                printf (_("%s - Certificate '%s' expires in %u %s (%s)\n"), 
(days_left>days_till_exp_crit) ? "WARNING" : "CRITICAL", cn, hours_left, 
hours_left > 0 ? "hours" : "minutes", timestamp);
+                if ( days_left > days_till_exp_crit) 
+                        return STATE_WARNING;
+                else
+                       return STATE_CRITICAL;
        } else if (time_left < 0) {
                printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, 
timestamp);
                status=STATE_CRITICAL;

Reply via email to