Module: check_mk
Branch: master
Commit: 1002e24e8815903571bce8fab0c09bde2b91f599
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1002e24e881590…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jul 10 16:39:10 2015 +0200
#2374 FIX md: Fix exception for certain outputs of certain special MD configurations
The parser in the check did not handle lines with the format
F+:
1463055360 blocks 64K chunks 2 near-copies [4/3] [UU_U]
F-:
correctly. This has been fixed.
---
.werks/2374 | 17 +++++++++++++++++
ChangeLog | 1 +
checks/md | 19 +++++++++++++++++--
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/.werks/2374 b/.werks/2374
new file mode 100644
index 0000000..8e4d139
--- /dev/null
+++ b/.werks/2374
@@ -0,0 +1,17 @@
+Title: md: Fix exception for certain outputs of certain special MD configurations
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1436539095
+
+The parser in the check did not handle lines with the format
+
+F+:
+ 1463055360 blocks 64K chunks 2 near-copies [4/3] [UU_U]
+F-:
+
+correctly. This has been fixed.
+
diff --git a/ChangeLog b/ChangeLog
index 0ce53b6..145acba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
* 1266 FIX: cisco_mem_asa: Special memory check for cisco asa devices....
NOTE: Please refer to the migration notes!
* 2400 FIX: windows_if.ps1: fixed exception in plugin when an interface team had no
members
+ * 2374 FIX: md: Fix exception for certain outputs of certain special MD
configurations...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/md b/checks/md
index 505941e..291340c 100644
--- a/checks/md
+++ b/checks/md
@@ -93,6 +93,20 @@
# unused devices: <none>
# ----------------------------------------------------------
+# And now for something completely different:
+# ---------------------------------------------------------
+# Personalities : [raid1] [raid10]
+# md1 : active raid10 sdd6[3] sdb6[1] sda6[0]
+# 1463055360 blocks 64K chunks 2 near-copies [4/3] [UU_U]
+#
+# md0 : active raid1 sdd1[3] sdb1[1] sda1[0]
+# 104320 blocks [4/3] [UU_U]
+#
+# unused devices: <none>
+# ---------------------------------------------------------
+
+# TODO: Write a parse function!
+
def inventory_md(info):
inventory = []
for line in info:
@@ -107,6 +121,7 @@ def inventory_md(info):
inventory.append( (device, None) )
return inventory
+
def check_md(item, _no_params, info):
raid_state = ''
its_next = False
@@ -135,7 +150,7 @@ def check_md(item, _no_params, info):
elif state_next:
if num_disks == expected_disks and active_disks == working_disks:
return (0, 'raid active, disk state is %s %s' % (disk_state_1,
disk_state_2))
- if len(line) > 6 and line[-6] != '':
+ if len(line) > 6 and line[-6] != '' and "speed=" in
line[-1]:
build_state_1 = line[-6]
build_state_2 = line[-4]
build_est = line[-2].partition('=')[2]
@@ -144,7 +159,7 @@ def check_md(item, _no_params, info):
(disk_state_1, disk_state_2, expected_disks, build_state_1,
build_state_2, build_speed, build_est))
return (2, 'disk state is %s %s (expected %d disks to be up)' %
(disk_state_1, disk_state_2, expected_disks))
- return (2, 'no raid device %s' % item)
+ return (2, 'no RAID device %s' % item)