Răsfoiți Sursa

Update sslutils.c

optimize output if certificate expires in less then 24h
thx to axel.schmalowsky@sixt.com for this patch
Matthias Hähnel 10 ani în urmă
părinte
comite
7d95d7bd66
1 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 7 0
      plugins/sslutils.c

+ 7 - 0
plugins/sslutils.c

@@ -232,6 +232,13 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){
 			return STATE_WARNING;
 			return STATE_WARNING;
 		else
 		else
 			return STATE_CRITICAL;
 			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) {
 	} else if (time_left < 0) {
 		printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, timestamp);
 		printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, timestamp);
 		status=STATE_CRITICAL;
 		status=STATE_CRITICAL;