Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / hp_proliant
blobd9307d51851ed001b60fab205e547b49ac245609
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.232.11.1.3.0 1
28 # .1.3.6.1.4.1.232.11.2.14.1.1.5.0 "2009.05.18"
29 # .1.3.6.1.4.1.232.2.2.2.1.0 "GB8851CPPH
32 def inventory_proliant_general(info):
33 if len(info) > 0 and len(info[0]) > 1 and info[0][0]:
34 return [(None, None)]
37 def check_proliant_general(item, no_params, info):
38 if not info:
39 return 3, "Status not found in snmp data"
41 map_states = {
42 "1": (3, "unknown"),
43 "2": (0, "OK"),
44 "3": (1, "degraded"),
45 "4": (2, "failed"),
48 status, firmware, serial_number = info[0]
49 state, state_readable = map_states.get(status, (3, "unhandled[%s]" % status))
50 return state, "Status: %s, Firmware: %s, S/N: %s" % \
51 (state_readable, firmware, serial_number)
54 check_info["hp_proliant"] = {
55 'inventory_function' : inventory_proliant_general,
56 'check_function' : check_proliant_general,
57 'service_description' : 'General Status',
58 'snmp_info' : ('.1.3.6.1.4.1.232', [
59 '11.1.3.0', # CPQHOST-MIB::cpqHoMibCondition
60 '11.2.14.1.1.5.0', # cpqHoFwVerVersion
61 '2.2.2.1.0', # CPQSINFO-MIB::cpqSiSysSerialNum
62 ]),
63 'snmp_scan_function' : lambda oid: "8072.3.2.10" in oid(".1.3.6.1.2.1.1.2.0") or
64 (".1.3.6.1.4.1.311.1.1.3.1.2" in oid(".1.3.6.1.2.1.1.2.0") and \
65 oid(".1.3.6.1.4.1.232.11.1.3.0")),