Module: check_mk
Branch: master
Commit: 9d2477505ed30cd287a5b0ebfb4be636b7d528fd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9d2477505ed30c…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Sep 6 16:13:03 2018 +0200
6489 FIX mssql_backup: Fixed parsing of backup date, time and type
Change-Id: Iacc7958f40255d241fdcbdcab972e6f641a800a1
---
.werks/6489 | 10 ++++++++++
checks/mssql_backup | 47 ++++++++++++++++++++++++++++-------------------
2 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/.werks/6489 b/.werks/6489
new file mode 100644
index 0000000..a668698
--- /dev/null
+++ b/.werks/6489
@@ -0,0 +1,10 @@
+Title: mssql_backup: Fixed parsing of backup date, time and type
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1536243168
+Class: fix
+
+
diff --git a/checks/mssql_backup b/checks/mssql_backup
index 961dd66..abf6870 100644
--- a/checks/mssql_backup
+++ b/checks/mssql_backup
@@ -24,28 +24,32 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Old agent
# <<<mssql_backup>>>
-# MSSQL_SQLEXPRESS test123 1331207325
+# MSSQL_SQLEXPRESS1 test123 1331207325
-# Newer agent
# <<<mssql_backup>>>
-# MSSQL_SQL0x master 2016-07-08 20:20:27
-# MSSQL_SQL0x model 2016-07-08 20:20:28
-# MSSQL_SQL0x model 2016-07-12 09:09:42
-# MSSQL_SQL0x model 2016-07-11 20:20:07
-# MSSQL_SQL0x msdb 2016-07-08 20:20:43
-# MSSQL_SQL0x msdb 2016-07-11 20:20:07
-
-# New agent (added backup type)
-# <<<mssql_backup>>>
-# MSSQL_SQL0x master 2016-07-08 20:20:27 D
-# MSSQL_SQL0x model 2016-07-08 20:20:28 D
-# MSSQL_SQL0x model 2016-07-12 09:09:42 L
-# MSSQL_SQL0x model 2016-07-11 20:20:07 I
-# MSSQL_SQL0x msdb 2016-07-08 20:20:43 D
-# MSSQL_SQL0x msdb 2016-07-11 20:20:07 I
+# MSSQL_SQL0x2 master 2016-07-08 20:20:27
+# MSSQL_SQL0x2 model 2016-07-08 20:20:28
+# MSSQL_SQL0x2 model 2016-07-12 09:09:42
+# MSSQL_SQL0x2 model 2016-07-11 20:20:07
+# MSSQL_SQL0x2 msdb 2016-07-08 20:20:43
+# MSSQL_SQL0x2 msdb 2016-07-11 20:20:07
+# <<<mssql_backup>>>
+# MSSQL_SQL0x3 master 2016-07-08 20:20:27 D
+# MSSQL_SQL0x3 model 2016-07-08 20:20:28 D
+# MSSQL_SQL0x3 model 2016-07-12 09:09:42 L
+# MSSQL_SQL0x3 model 2016-07-11 20:20:07 I
+# MSSQL_SQL0x3 msdb 2016-07-08 20:20:43 D
+# MSSQL_SQL0x3 msdb 2016-07-11 20:20:07 I
+
+# <<<mssql_backup:sep(124)>>>
+# MSSQL_SQL0x4|master|2016-07-08 20:20:27|D
+# MSSQL_SQL0x4|model|2016-07-08 20:20:28|D
+# MSSQL_SQL0x4|model|2016-07-12 09:09:42|L
+# MSSQL_SQL0x4|model|2016-07-11 20:20:07|I
+# MSSQL_SQL0x4|msdb|2016-07-08 20:20:43|D
+# MSSQL_SQL0x4|msdb|2016-07-11 20:20:07|I
factory_settings["mssql_backup_default_levels"] = {
"database": (None, None),
@@ -94,7 +98,12 @@ def parse_mssql_backup(info):
timestamp = _parse_date_and_time(backup_date, backup_time)
elif len(line) == 4:
- inst, tablespace, backup_date, backup_time = line
+ inst, tablespace = line[:2]
+ try:
+ backup_date, backup_time = line[2].split(" ")
+ backup_type = line[3]
+ except ValueError:
+ backup_date, backup_time = line[2:4]
timestamp = _parse_date_and_time(backup_date, backup_time)
elif len(line) == 3: