Module: check_mk
Branch: master
Commit: 77b41e1459025c070819d627fe819c9ad0158632
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=77b41e1459025c…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Mon Dec 12 17:31:39 2016 +0100
4103 FIX kaspersky_av_client: No longer crash when date of last full scan is unknown
If no last full scan date is provided by the agent, this is treated as unknown.
Change-Id: I32a1331d7197e11190f34773b9fee97c36d65ac1
---
.werks/4103 | 10 ++++++++++
ChangeLog | 1 +
checks/kaspersky_av_client | 37 ++++++++++++++++++++-----------------
3 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/.werks/4103 b/.werks/4103
new file mode 100644
index 0000000..b480a46
--- /dev/null
+++ b/.werks/4103
@@ -0,0 +1,10 @@
+Title: kaspersky_av_client: No longer crash when date of last full scan is unknown
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1481560244
+
+If no last full scan date is provided by the agent, this is treated as unknown.
diff --git a/ChangeLog b/ChangeLog
index f0ad00a..d33dd86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,6 +65,7 @@
* 4162 FIX: esx_vsphere_vm.heartbeat: fixed KeyError
* 4163 FIX: kernel: fixed empty data handling
* 4164 FIX: livestatus_status: fixed ValueError for values in scientific notation
+ * 4103 FIX: kaspersky_av_client: No longer crash when date of last full scan is unknown...
Multisite:
* 4070 Added a painter for the service check period
diff --git a/checks/kaspersky_av_client b/checks/kaspersky_av_client
index 14b3a89..f70349a 100644
--- a/checks/kaspersky_av_client
+++ b/checks/kaspersky_av_client
@@ -65,24 +65,27 @@ def check_kaspersky_av_client(_no_item, params, parsed):
( "signature_age", "Last update of signatures" ),
( "fullscan_age", "Last fullscan" ),
]:
- age = parsed[key]
- warn, crit = params[key]
- if age >= crit:
- state = 2
- elif age >= warn:
- state = 1
+ age = parsed.get(key)
+ if age == None:
+ yield 3, what + ": unknown"
else:
- state = 0
-
- infotext = "%s %s ago" % (what, get_age_human_readable(age))
- if state > 0:
- infotext += " (warn/crit at %s/%s)" % (
- get_age_human_readable(warn),
- get_age_human_readable(crit))
-
- yield state, infotext
-
- if parsed["fullscan_failed"]:
+ warn, crit = params[key]
+ if age >= crit:
+ state = 2
+ elif age >= warn:
+ state = 1
+ else:
+ state = 0
+
+ infotext = "%s %s ago" % (what, get_age_human_readable(age))
+ if state > 0:
+ infotext += " (warn/crit at %s/%s)" % (
+ get_age_human_readable(warn),
+ get_age_human_readable(crit))
+
+ yield state, infotext
+
+ if parsed.get("fullscan_failed"):
yield 2, "Last fullscan failed"