2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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 # Author: Lars Michelsen <lm@mathias-kettner.de>
29 hp_sts_drvbox_type_map
= {
31 '2': 'ProLiant Storage System',
32 '3': 'ProLiant-2 Storage System',
33 '4': 'internal ProLiant-2 Storage System',
34 '5': 'proLiant2DuplexTop',
35 '6': 'proLiant2DuplexBottom',
36 '7': 'proLiant2InternalDuplexTop',
37 '8': 'proLiant2InternalDuplexBottom',
40 hp_sts_drvbox_cond_map
= {
47 hp_sts_drvbox_fan_map
= {
55 hp_sts_drvbox_temp_map
= {
60 '5': (None, 'noTemp'),
63 hp_sts_drvbox_sp_map
= {
65 '2': (0, 'sidePanelInPlace'),
66 '3': (2, 'sidePanelRemoved'),
67 '4': (None, 'noSidePanelStatus'),
70 hp_sts_drvbox_power_map
= {
75 '5': (None, 'noFltTolPower'),
79 def inventory_hp_sts_drvbox(info
):
81 return [(line
[0] + '/' + line
[1], None) for line
in info
if line
[3] != ''
82 ] # only inventorize rows with "model" set
85 def check_hp_sts_drvbox(item
, _no_params
, info
):
87 if line
[0] + '/' + line
[1] == item
:
88 _c_index
, _b_index
, ty
, model
, fan_status
, cond
, \
89 temp_status
, sp_status
, pwr_status
, serial
, loc
= line
94 for val
, label
, map_
in [
95 (fan_status
, 'Fan-Status', hp_sts_drvbox_fan_map
),
96 (cond
, 'Condition', hp_sts_drvbox_cond_map
),
97 (temp_status
, 'Temp-Status', hp_sts_drvbox_temp_map
),
98 (sp_status
, 'Sidepanel-Status', hp_sts_drvbox_sp_map
),
99 (pwr_status
, 'Power-Status', hp_sts_drvbox_power_map
),
101 this_state
= map_
[val
][0]
102 if this_state
is None:
103 continue # skip unsupported checks
107 elif this_state
== 2:
109 sum_state
= max(sum_state
, this_state
)
110 output
.append('%s: %s%s' % (label
, map_
[val
][1], state_txt
))
112 output
.append('(Type: %s, Model: %s, Serial: %s, Location: %s)' %
113 (hp_sts_drvbox_type_map
.get(ty
, 'unknown'), model
, serial
, loc
))
115 return (sum_state
, ', '.join(output
))
116 return (3, "Controller not found in snmp data")
119 check_info
["hp_sts_drvbox"] = {
120 'check_function': check_hp_sts_drvbox
,
121 'inventory_function': inventory_hp_sts_drvbox
,
122 'service_description': 'Drive Box %s',
124 '.1.3.6.1.4.1.232.8.2.1.1',
126 '1', # cpqSsBoxCntlrIndex
127 '2', # cpqSsBoxBusIndex
130 '7', # cpqSsBoxFanStatus
131 '8', # cpqSsBoxCondition
132 '9', # cpqSsBoxTempStatus
133 '10', # cpqSsBoxSidePanelStatus
134 '11', # cpqSsBoxFltTolPwrSupplyStatus
135 '17', # cpqSsBoxSerialNumber
136 '23', # cpqSsBoxLocationString
138 'snmp_scan_function': lambda oid
: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0", "").lower(),