Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / dell_idrac_virtdisks
blob4d3f7f4e216cfcdbff07e9ac0eff7c008fb6af2b
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.
27 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.1 System --> IDRAC-MIB::virtualDiskName.1
28 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.2 Oracle --> IDRAC-MIB::virtualDiskName.2
29 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.2.3 Backup --> IDRAC-MIB::virtualDiskName.3
30 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.1 2 --> IDRAC-MIB::virtualDiskState.1
31 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.2 2 --> IDRAC-MIB::virtualDiskState.2
32 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.3 2 --> IDRAC-MIB::virtualDiskState.3
33 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.1 3 --> IDRAC-MIB::virtualDiskComponentStatus.1
34 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.2 3 --> IDRAC-MIB::virtualDiskComponentStatus.2
35 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.20.3 3 --> IDRAC-MIB::virtualDiskComponentStatus.3
36 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.1 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.1
37 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.2 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.2
38 # .1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.34.3 1 --> IDRAC-MIB::virtualDiskRemainingRedundancy.3
41 def inventory_dell_idrac_virtdisks(info):
42 return [(line[0], None) for line in info]
45 def check_dell_idrac_virtdisks(item, _no_params, info):
46 map_states = {
47 "disk": {
48 "1": (1, "unknown"),
49 "2": (0, "online"),
50 "3": (2, "failed"),
51 "4": (2, "degraded"),
53 "component": {
54 "1": (0, "other"),
55 "2": (1, "unknown"),
56 "3": (0, "OK"),
57 "4": (1, "non-critical"),
58 "5": (2, "critical"),
59 "6": (2, "non-recoverable"),
61 "raidlevel": {
62 "1": "none",
63 "2": "Raid-0",
64 "3": "Raid-1",
65 "4": "Raid-5",
66 "5": "Raid-6",
67 "6": "Raid-10",
68 "7": "Raid-50",
69 "8": "Raid-60",
72 for name, disk_state, raid_level, component_state, redundancy in info:
73 if item == name:
74 yield 0, "Raid level: %s" % map_states["raidlevel"][raid_level]
76 for what, what_key in [(disk_state, "Disk"), (component_state, "Component")]:
77 state, state_readable = map_states[what_key.lower()][what]
78 yield state, "%s status: %s" % (what_key, state_readable)
80 yield 0, "Remaining redundancy: %s physical disk(s)" % redundancy
83 check_info["dell_idrac_virtdisks"] = {
84 "check_function": check_dell_idrac_virtdisks,
85 "inventory_function": inventory_dell_idrac_virtdisks,
86 "service_description": "Virtual Disk %s",
87 "snmp_scan_function": lambda oid: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.1.674.10892.5",
88 "snmp_info": (
89 ".1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1",
91 "2", # virtualDiskName
92 "4", # virtualDiskState
93 "13", # virtualDiskRaidLevel
94 "20", # virtualComponentStatus
95 "34", # virtualDiskRemainingRedundancy
96 ]),