Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / dell_eql_storage
blob29c4eddfaf13b9ea2bc12d185828a8f473f4152a
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2013 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 inventory_dell_eql_storage(info):
29 for line in info:
30 yield line[0], {}
33 def check_dell_eql_storage(item, _no_params, info):
34 for name, desc, health_state, raid_state, total_storage, \
35 repl_storage, snap_storage, used_storage in info:
36 if name == item:
37 if desc:
38 yield 0, desc
40 # Health Status:
41 health_states = {
42 "0": "Unknown",
43 "1": "Normal",
44 "2": "Warning",
45 "3": "Critical",
47 if health_state == "1":
48 state = 0
49 elif health_state in ["2", "0"]:
50 state = 1
51 else:
52 state = 2
53 yield state, "Health State: %s" % health_states[health_state]
55 # Raid Status
56 raid_states = {
57 "1": "Ok",
58 "2": "Degraded",
59 "3": "Verifying",
60 "4": "Reconstructing",
61 "5": "Failed",
62 "6": "CatastrophicLoss",
63 "7": "Expanding",
64 "8": "Mirroring",
67 if raid_state == "1":
68 state = 0
69 elif raid_state in ["3", "4", "7", "8"]:
70 state = 1
71 else:
72 state = 2
73 yield state, "Raid State: %s" % raid_states[raid_state]
75 # Storage
76 total_bytes = int(total_storage) * 1048576
77 used_bytes = int(used_storage) * 1048576
78 repl_bytes = int(repl_storage) * 1048576
79 snap_bytes = int(snap_storage) * 1048576
80 perfdata = [("fs_used", used_bytes), ("fs_size", total_bytes)]
81 yield 0, "Used: %s/%s (Snapshots: %s, Replication: %s)" % \
82 (get_bytes_human_readable(used_bytes), \
83 get_bytes_human_readable(total_bytes),\
84 get_bytes_human_readable(snap_bytes),\
85 get_bytes_human_readable(repl_bytes)),\
86 perfdata
90 check_info["dell_eql_storage"] = {
91 "check_function" : check_dell_eql_storage,
92 "inventory_function" : inventory_dell_eql_storage,
93 "service_description" : "Storage %s",
94 "has_perfdata" : True,
95 "snmp_scan_function" : lambda oid: "EQL-SUP" in oid(".1.3.6.1.2.1.1.1.0") or \
96 oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.12740.17"),
97 "snmp_info" : (".1.3.6.1.4.1.12740.2.1", [
98 "1.1.9.1", #eqlMemberName
99 "1.1.7.1", #eqlMemberDescription
100 "5.1.1.1", #eqlMemberHealthStatus
101 "13.1.1.1", #eqlMemberRaidStatus
102 "10.1.1.1", #eqlMemberTotalStorage
103 "10.1.4.1", #eqlMemberReplStorage
104 "10.1.3.1", #eqlMemberSnapStorage
105 "10.1.2.1", #eqlMemberUsedStorage