Cleanup config.nodes_of
[check_mk.git] / checks / dell_compellent_disks
blob536bc767fc95b1183d4c8542bc0779485a598f21
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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 # example output
28 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.2.1 1
29 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.2.2 2
30 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.3.1 1
31 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.3.2 1
32 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.5.1 1
33 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.5.2 1
34 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.6.1 ""
35 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.6.2 ""
36 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.11.1 1
37 # .1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.11.2 1
40 def parse_dell_compellent_disks(info):
41 # Need to be compatible with shared inventory function
42 parsed = []
43 for part in info:
44 for line in part:
45 if len(line) == 5:
46 parsed.append(line)
47 for part in info:
48 for idx, line in enumerate(part):
49 if len(line) == 1:
50 parsed[idx].append(line[0])
51 return parsed
54 def check_dell_compellent_disks(item, _no_params, parsed):
55 for number, status, health, health_message, enclosure, serial in parsed:
56 if number == item:
57 state, state_readable = dell_compellent_translate("ScStatus", status)
58 yield state, "Status: %s, Location: Enclosure %s, Serial number: %s" % \
59 (state_readable, enclosure, serial)
61 if not health_message == "":
62 state = dell_compellent_translate("Health", health)
63 yield state, "Health: %s, Health message: %s" % \
64 (health, health_message)
67 check_info['dell_compellent_disks'] = {
68 'parse_function': parse_dell_compellent_disks,
69 'inventory_function': inventory_dell_compellent,
70 'check_function': check_dell_compellent_disks,
71 'service_description': 'Disk %s',
72 'snmp_info': [
74 '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1',
76 "2", # DELL-STORAGE-SC-MIB::scDiskNbr
77 "3", # DELL-STORAGE-SC-MIB::scDiskStatus
78 "5", # DELL-STORAGE-SC-MIB::scDiskHealthy
79 "6", # DELL-STORAGE-SC-MIB::scDiskStatusMsg
80 "11", # DELL-STORAGE-SC-MIB::scDiskEnclosure
81 ]),
83 '.1.3.6.1.4.1.674.11000.2000.500.1.2.45.1',
85 "3", # DELL-STORAGE-SC-MIB::scDiskConfigSerial
86 ]),
88 'snmp_scan_function': lambda oid: oid(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"),
89 'includes': ["dell_compellent.include"],