Module: check_mk
Branch: master
Commit: 3efc78a38566530fb602d34f50eb344f4628fae4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3efc78a3856653…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Jan 9 09:15:16 2014 +0100
FIX timemachine: Check now also works if there are spaces in the name of the backup volume
or the hostname
---
.werks/322 | 8 ++++++++
ChangeLog | 1 +
checks/timemachine | 6 +++---
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/.werks/322 b/.werks/322
new file mode 100644
index 0000000..699ed42
--- /dev/null
+++ b/.werks/322
@@ -0,0 +1,8 @@
+Title: timemachine: Check now also works if there are spaces in the name of the backup
volume or the hostname
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1389255252
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 97ef9ec..a3ae771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -82,6 +82,7 @@
* 0113 FIX: blade_blades: Now only make inventory for blades that are powered on...
* 0442 FIX: dell_om_disks: Treat global host spare disks as OK, instead of WARN...
* 0443 FIX: brocade_fcport: cope with firmware that does not provide speed
information...
+ * 0322 FIX: timemachine: Check now also works if there are spaces in the name of the
backup volume or the hostname
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/checks/timemachine b/checks/timemachine
index 8fb0b00..d77e3cb 100644
--- a/checks/timemachine
+++ b/checks/timemachine
@@ -40,13 +40,13 @@ def inventory_timemachine(info):
return [(None, backup_timemachine_default_levels)]
def check_timemachine(item, params, info):
- if len(info[0]) > 1:
- message = " ".join(info[0])
+ message = " ".join(info[0])
+ if not
re.match('/Volumes/.+/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]$',
message):
return 2, "Backup seems to have failed, message was: %s" % message
warn, crit = params['age']
now = datetime.datetime.now()
- tokens = info[0][0].split("/")
+ tokens = message.split("/")
timestamp = tokens[-1]
state = 0
result =
re.match('([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])-([0-9][0-9])([0-9][0-9])([0-9][0-9])',
timestamp)