Module: check_mk
Branch: master
Commit: 2ebdf5f66801c99a577da2ac5ae7185ca4d3be6c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ebdf5f66801c9…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jun 13 11:04:48 2018 +0200
6134 FIX sap_hana_full_backup: Fixed crash if backup is running
Change-Id: Ibcd249d2b0f6c1ff3bc05b89d4d007d479286e4b
---
.werks/6134 | 10 ++++++++++
checks/sap_hana_full_backup | 14 +++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/.werks/6134 b/.werks/6134
new file mode 100644
index 0000000..6c217b3
--- /dev/null
+++ b/.werks/6134
@@ -0,0 +1,10 @@
+Title: sap_hana_full_backup: Fixed crash if backup is running
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1528880664
+Class: fix
+
+
diff --git a/checks/sap_hana_full_backup b/checks/sap_hana_full_backup
index 97248ac..25f9e2b 100644
--- a/checks/sap_hana_full_backup
+++ b/checks/sap_hana_full_backup
@@ -34,8 +34,8 @@ def parse_sap_hana_full_backup(info):
continue
date, age_days, duration, backup_state = [x.strip() for x in line[:4]]
parsed.setdefault(instance, {
- "age_days": int(age_days),
- "duration": int(duration),
+ "age_days": age_days,
+ "duration": duration,
"date": date.replace('"', ''),
"state": backup_state.replace('"', ''),
})
@@ -51,12 +51,16 @@ def check_sap_hana_full_backup(item, params, parsed):
if not data:
return
backup_state = data["state"]
+ infotext = "Status: %s" % backup_state
+ if backup_state == "running":
+ return 0, infotext
+
state = 0
if backup_state != "successful":
state = 2
- return state, 'Status: %s, Duration: %s, %s days ago' % \
- (backup_state, get_age_human_readable(data["duration"]),
- data["age_days"])
+ return state, '%s, Duration: %s, %s days ago' % \
+ (infotext, get_age_human_readable(int(data["duration"])),
+ int(data["age_days"]))
check_info['sap_hana_full_backup'] = {