diff options
| author | Matthias Hähnel <github.com@drhaehnel.de> | 2015-04-20 09:26:59 +0200 |
|---|---|---|
| committer | Sven Nierlein <sven@nierlein.de> | 2015-10-02 15:56:18 +0200 |
| commit | 2ce22968427ce3cadf5214bda659098032f86efd (patch) | |
| tree | 58611f16291b60106913961490a6ce19d3ee9176 | |
| parent | a9b02e7affe6d940e1fb4830156d06e4d816458b (diff) | |
| download | monitoring-plugins-2ce22968427ce3cadf5214bda659098032f86efd.tar.gz | |
Update sslutils.c
optimize output if certificate expires in less then 24h
thx to axel.schmalowsky@sixt.com for this patch
| -rw-r--r-- | plugins/sslutils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index d0ae4741..69d12f21 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){ | |||
| 221 | return STATE_WARNING; | 221 | return STATE_WARNING; |
| 222 | else | 222 | else |
| 223 | return STATE_CRITICAL; | 223 | return STATE_CRITICAL; |
| 224 | } else if (days_left == 0 && time_left > 0) { | ||
| 225 | int hours_left = (int) time_left/3600; | ||
| 226 | 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); | ||
| 227 | if ( days_left > days_till_exp_crit) | ||
| 228 | return STATE_WARNING; | ||
| 229 | else | ||
| 230 | return STATE_CRITICAL; | ||
| 224 | } else if (time_left < 0) { | 231 | } else if (time_left < 0) { |
| 225 | printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, timestamp); | 232 | printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, timestamp); |
| 226 | status=STATE_CRITICAL; | 233 | status=STATE_CRITICAL; |
