Module: check_mk
Branch: master
Commit: d0bda357edb22be61825aea2e922a4d574ce0e86
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0bda357edb22b…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Mar 13 16:20:48 2017 +0100
4537 FIX hyperv_checkpoints: Fixed wrong detection of checkpoint
The original plugin expected an leading line which never existed. Therfore
the amount of checkpoints has been undercharged.
Change-Id: Iac4adaecbd1b49afcd6b3a5588375be7487dbe72
---
.werks/4537 | 11 +++++++++++
checks/hyperv_checkpoints | 10 +++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/4537 b/.werks/4537
new file mode 100644
index 0000000..3acebd8
--- /dev/null
+++ b/.werks/4537
@@ -0,0 +1,11 @@
+Title: hyperv_checkpoints: Fixed wrong detection of checkpoint
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1489418293
+Class: fix
+
+The original plugin expected an leading line which never existed. Therfore
+the amount of checkpoints has been undercharged.
diff --git a/checks/hyperv_checkpoints b/checks/hyperv_checkpoints
index 5ce7909..52af648 100644
--- a/checks/hyperv_checkpoints
+++ b/checks/hyperv_checkpoints
@@ -35,9 +35,13 @@ def inventory_hyperv_checkpoints(info):
def check_hyperv_checkpoints(item, params, info):
oldest = 0
- for snapshot, age in info[1:]:
+ number_of_checkpoints = 0
+
+ for line in info:
+ snapshot, age = line
oldest = max(int(age), oldest)
- number_of_checkpoints = len(info[1:])
+ number_of_checkpoints += 1
+
if number_of_checkpoints > 0:
state = 0
if params.get('age'):
@@ -50,7 +54,7 @@ def check_hyperv_checkpoints(item, params, info):
else:
perfdata = [("age", oldest)]
return state, "%s Checkpoints, Oldest is: %s" % \
- (len(info[1:]), get_age_human_readable(oldest)), perfdata
+ (number_of_checkpoints, get_age_human_readable(oldest)),
perfdata
else:
return 0, "No Checkpoints found", [("age", 0)]