Cleanup config.nodes_of
[check_mk.git] / checks / stormshield_disk
blob7188a9ac1b5b827b013bf85967998da41a750b51
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 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.
28 def parse_stormshield_disk(info):
29 standalone, cluster = info
30 parsed = []
31 if not cluster and not standalone:
32 return []
33 if cluster != []:
34 for item in cluster:
35 new_info = []
36 index = item[0].split('.')[0]
37 new_info.append(index)
38 new_info.extend(item[1:])
39 parsed.append(new_info)
40 return parsed
42 new_info = []
43 new_info.append('0')
44 new_info.extend(standalone[0])
45 parsed.append(new_info)
46 return parsed
49 def inventory_stormshield_disk(parsed):
50 for disk in parsed:
51 clusterindex = disk[0]
52 yield clusterindex, {}
55 def check_stormshield_disk(item, params, parsed):
56 for disk in parsed:
57 clusterindex, index, name, selftest, israid, raidstatus, position = disk
58 if item == clusterindex:
59 infotext = 'Device Index %s, Selftest: %s, Device Mount Point Name: %s' % (
60 index, selftest, name)
61 if selftest != 'PASSED':
62 status = 1
63 else:
64 status = 0
65 if israid != '0':
66 infotext = infotext + ', Raid active, Raid Status %s, Disk Position %s' % (
67 raidstatus, position)
68 yield status, infotext
71 check_info['stormshield_disk'] = {
72 'parse_function': parse_stormshield_disk,
73 'inventory_function': inventory_stormshield_disk,
74 'check_function': check_stormshield_disk,
75 'service_description': 'Disk %s',
76 'snmp_info': [
78 '.1.3.6.1.4.1.11256.1.11.11.1',
81 '1', # snsNodeDiskIndex
82 '2', # snsDiskEntryDiskName
83 '3', # snsDiskEntrySmartResult
84 '4', # snsDiskEntryIsRaid
85 '5', # snsDiskEntryRaidStatus
86 '6', # snsDiskEntryPosition
87 ]),
89 '.1.3.6.1.4.1.11256.1.10.5.1',
92 '1', # snsNodeDiskIndex
93 '2', # snsDiskEntryDiskName
94 '3', # snsDiskEntrySmartResult
95 '4', # snsDiskEntryIsRaid
96 '5', # snsDiskEntryRaidStatus
97 '6', # snsDiskEntryPosition
98 ]),
100 'snmp_scan_function': stormshield_scan_function,
101 'includes': ['stormshield.include'],