Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / cisco_ucs_lun
blob59deac9e3f1f2c4fa339a3c5c64b6c203fafca78
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2018 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 # tails. 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 # comNET GmbH, Fabian Binder - 2018-05-07
29 # .1.3.6.1.4.1.9.9.719.1.45.8.1.14 cucsStorageLocalLunType
30 # .1.3.6.1.4.1.9.9.719.1.45.8.1.13 cucsStorageLocalLunSize
31 # .1.3.6.1.4.1.9.9.719.1.45.8.1.9 cucsStorageLocalLunOperability
33 map_luntype = {
34 '0': (2, "unspecified"),
35 '1': (1, "simple"),
36 '2': (0, "mirror"),
37 '3': (1, "stripe"),
38 '4': (0, "lun"),
39 '5': (0, "stripeParity"),
40 '6': (0, "stripeDualParity"),
41 '7': (0, "mirrorStripe"),
42 '8': (0, "stripeParityStripe"),
43 '9': (0, "stripeDualParityStripe"),
47 def inventory_cisco_ucs_lun(info):
48 return [(None, None)]
51 def check_cisco_ucs_lun(_no_item, _no_params, info):
52 mode, size, status = info[0]
53 state, state_readable = map_operability.get(status, (3, "Unknown, status code %s" % status))
54 mode_state, mode_state_readable = map_luntype.get(mode, (3, "Unknown, status code %s" % mode))
55 size_readable = get_bytes_human_readable(int(size) * 1024 * 1024) # size is returned in MB
56 yield state, "Status: %s" % state_readable
57 yield 0, "Size: %s" % size_readable
58 yield mode_state, "Mode: %s" % mode_state_readable
61 check_info["cisco_ucs_lun"] = {
62 "check_function": check_cisco_ucs_lun,
63 "inventory_function": inventory_cisco_ucs_lun,
64 "service_description": "LUN",
65 "snmp_scan_function": scan_cisco_ucs,
66 "snmp_info": (
67 ".1.3.6.1.4.1.9.9.719.1.45.8.1",
69 "14", # cucsStorageLocalLunType
70 "13", # cucsStorageLocalLunSize
71 "9", # cucsStorageLocalLunOperability
72 ]),
73 "includes": ["cisco_ucs.include"]