Module: check_mk
Branch: master
Commit: 5bfa8b9bbce9892187a3a435c338607216ca70e2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5bfa8b9bbce989…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Sep 3 11:19:46 2015 +0200
#2576 FIX symantec_av_updates: fix crash due to missing datetime module, also handle
DD.MM.YYYY date format
---
.werks/2576 | 10 ++++++++++
ChangeLog | 2 +-
checks/symantec_av_updates | 29 ++++++++++++++++++++---------
3 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/.werks/2576 b/.werks/2576
new file mode 100644
index 0000000..9138984
--- /dev/null
+++ b/.werks/2576
@@ -0,0 +1,10 @@
+Title: symantec_av_updates: fix crash due to missing datetime module, also handle
DD.MM.YYYY date format
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1441271945
+
+
diff --git a/ChangeLog b/ChangeLog
index e0a81f9..942079e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -155,8 +155,8 @@
* 2575 FIX: cpu.loads: Fix exception in displaying parameters for CPU load check...
* 2574 FIX: postfix_mailq: speed up agent part on FreeBSD
* 2566 FIX: ups_modulys_battery.temp: fixed missing manpage
- * 2584 FIX: include file for electrical phases handles warn/crit levels correct
* 2585 FIX: include file for elecritcal phases handles warn/crit levels correct
+ * 2576 FIX: symantec_av_updates: fix crash due to missing datetime module, also
handle DD.MM.YYYY date format
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/symantec_av_updates b/checks/symantec_av_updates
index 0463d63..41f0f4a 100644
--- a/checks/symantec_av_updates
+++ b/checks/symantec_av_updates
@@ -24,27 +24,38 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# <<<symantec_av_updates>>>
+# 15.05.2015 rev. 1
+
+# <<<symantec_av_updates>>>
+# 05/15/2015 rev. 1
symantec_av_updates_default_levels = ( 259200, 345600 )
+
def inventory_symantec_av_updates(info):
return [( None, 'symantec_av_updates_default_levels' )]
+
def check_symantec_av_updates( _no_item, params, info):
warn, crit = params
- last = info[0][0]
- last = datetime.datetime.strptime(last, "%m/%d/%y").date()
- age = abs((datetime.datetime.now().date() - last).days)
- age = 60*60*25*age
- rev = info[0][-1]
-
- message = "%s days since last update" % get_age_human_readable(age)
- if age > crit:
+ last_text = info[0][0]
+ if '/' in last_text:
+ last_broken = time.strptime(last_text, "%m/%d/%Y")
+ else:
+ last_broken = time.strptime(last_text, "%d.%m.%Y")
+
+ last_timestamp = time.mktime(last_broken)
+ age = time.time() - last_timestamp
+
+ message = "%s since last update" % get_age_human_readable(age)
+ if age >= crit:
return 2, message
- if age > warn:
+ if age >= warn:
return 1, message
return 0, message
+
check_info["symantec_av_updates"] = {
"check_function" : check_symantec_av_updates,
"group" : "antivir_update_age",