Module: check_mk
Branch: master
Commit: 11e1e049e4162e4f6ff340853f66094fd588d5e7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11e1e049e4162e…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Wed Jul 4 14:03:10 2018 +0200
md: don't change info.
Change-Id: I66eabbbf1493cc58badce915e37fbf5a6092615c
---
checks/md | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/checks/md b/checks/md
index c92891f..0492eec 100644
--- a/checks/md
+++ b/checks/md
@@ -131,13 +131,14 @@ def check_md(item, _no_params, info):
raid_state = line[2]
if raid_state != 'active' and raid_state !=
'active(auto-read-only)':
return (2, "raid state is '%s' (should be
'active')" % (raid_state,))
+ disk_list = line[4:]
# Usually (auto-read-only) sticks to active without a space.
# But on some kernels it appears separated by a space
if line[3] == '(auto-read-only)':
- del line[3]
- all_disks = len([x for x in line[4:]]) # all disks
- spare_disks = len([x for x in line[4:] if x.endswith("(S)") ]) #
spare disks
- failed_disks = len([x for x in line[4:] if x.endswith("(F)") ]) #
failed disks
+ disk_list.pop(0)
+ all_disks = len(disk_list) # all disks
+ spare_disks = len([x for x in disk_list if x.endswith("(S)") ]) #
spare disks
+ failed_disks = len([x for x in disk_list if x.endswith("(F)") ]) #
failed disks
active_disks = all_disks - spare_disks - failed_disks
its_next = True
elif its_next: