2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2015 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # ails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # <<<emcvnx_mirrorview:sep(58)>>>
28 # MirrorView Name: Mirror_Lun_306
29 # MirrorView Description:
30 # MirrorView UID: 50:06:01:60:88:60:50:CB:2E:00:00:00:00:00:00:00
31 # Logical Unit Numbers: 306
32 # Remote Mirror Status: Mirrored
33 # MirrorView State: Active
34 # MirrorView Faulted: NO
35 # MirrorView Transitioning: NO
36 # Quiesce Threshold: 60
37 # Minimum number of images required: 0
38 # Image Size: 1073741824
40 # Write Intent Log Used: YES
42 # Image UID: 50:06:01:60:88:60:50:CB
43 # Is Image Primary: YES
44 # Logical Unit UID: 60:06:01:60:11:21:3A:00:68:82:C2:16:F9:64:E4:11
45 # Image Condition: Primary Image
48 # Image UID: 50:06:01:60:88:60:4F:13
49 # Is Image Primary: NO
50 # Logical Unit UID: 60:06:01:60:18:21:3A:00:EF:4D:0B:A4:03:65:E4:11
51 # Image State: Consistent
52 # Image Condition: Normal
53 # Recovery Policy: Manual
55 # Synchronization Rate: Medium
57 # MirrorView Name: Mirror_LUN_205
62 # u'Logical Unit Numbers': u'53',
63 # u'Minimum number of images required': u'0',
64 # u'MirrorView Description': u'',
65 # u'MirrorView Faulted': u'NO',
66 # u'MirrorView State': u'Active',
67 # u'MirrorView Transitioning': u'NO',
68 # u'MirrorView UID': u'50:06:01:60:88:60:50:CB:3D:00:00:00:00:00:00:00',
69 # u'Quiesce Threshold': u'60',
70 # u'Remote Mirror Status': u'Mirrored',
71 # u'Write Intent Log Used': u'YES',
72 # u'Image Count': u'2',
73 # u'Image Size': u'10485760',
75 # u'50:06:01:60:88:60:4F:13': {
76 # u'Image Condition': u'Normal',
77 # u'Image State': u'Synchronized',
78 # u'Is Image Primary': u'NO',
79 # u'Logical Unit UID': u'60:06:01:60:18:21:3A:00:77:9A:BF:71:CA:68:E4:11',
80 # u'Preferred SP': u'A',
81 # u'Recovery Policy': u'Manual',
82 # u'Synchronization Rate': u'Medium',
84 # u'50:06:01:60:88:60:50:CB': {
85 # u'Image Condition': u'Primary Image',
86 # u'Is Image Primary': u'YES',
87 # u'Logical Unit UID': u'60:06:01:60:11:21:3A:00:5A:85:A0:F7:F7:64:E4:11',
88 # u'Preferred SP': u'A',
95 def parse_emcvnx_mirrorview(info
):
98 if ' '.join(line
).startswith("Unable to validate the identity of the server."):
101 elif line
[0] == "MirrorView Name":
102 lun_name
= line
[1].replace("_", " ").replace("Mirror", "").strip()
103 parsed
.setdefault(lun_name
, {})
107 lun_value
= ":".join(line
[1:]).strip()
109 lun_value
= " ".join(line
[1:]).strip()
111 if line
[0] == "Images":
112 parsed
[lun_name
].setdefault("Images", {})
114 if "Images" in parsed
[lun_name
]:
115 if line
[0] == "Image UID":
116 image_uid
= lun_value
117 parsed
[lun_name
]["Images"].setdefault(image_uid
, {})
119 parsed
[lun_name
]["Images"][image_uid
][line
[0]] = lun_value
121 parsed
[lun_name
][line
[0]] = lun_value
125 def inventory_emcvnx_mirrorview(parsed
):
126 return [ (lun_name
, None) for lun_name
, lun_states
in parsed
.items() \
127 if lun_states
["MirrorView State"].lower() == "active" ]
130 def check_emcvnx_mirrorview(item
, params
, parsed
):
132 "no": (0, "NO, mirror is running as expected"),
133 "yes": (2, "YES, mirror broken"),
134 "active": (0, "normal (all IOs are allowed)"),
135 "attention": (1, "something happened to the mirrored image"),
136 "inactive": (2, "stopped mirroring"),
139 state
, state_readable
= map_state
[parsed
[item
]["MirrorView State"].lower()]
140 yield state
, "Status: %s" % state_readable
142 _state_faulted
, state_readable_faulted
= map_state
[parsed
[item
]["MirrorView Faulted"].
144 yield state
, "Faulted: %s" % state_readable_faulted
147 check_info
['emcvnx_mirrorview'] = {
148 'parse_function': parse_emcvnx_mirrorview
,
149 'inventory_function': inventory_emcvnx_mirrorview
,
150 'check_function': check_emcvnx_mirrorview
,
151 'service_description': 'Mirror view %s',