GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / hp_blade
blobdfa7fababe7ed02a920c396ec0c0df1561f6c3b2
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 # Author: Lars Michelsen <lm@mathias-kettner.de>
29 # General Status:
30 # '.1.3.6.1.4.1.232.22.2.3.1.1.1.5' => 'cpqRackCommonEnclosurePartNumber',
31 # '.1.3.6.1.4.1.232.22.2.3.1.1.1.6' => 'cpqRackCommonEnclosureSparePartNumber',
32 # '.1.3.6.1.4.1.232.22.2.3.1.1.1.7' => 'cpqRackCommonEnclosureSerialNum',
33 # '.1.3.6.1.4.1.232.22.2.3.1.1.1.8' => 'cpqRackCommonEnclosureFWRev',
34 # '.1.3.6.1.4.1.232.22.2.3.1.1.1.16' => 'cpqRackCommonEnclosureCondition',
36 # GENERAL MAPS:
38 hp_blade_status_map = {1: 'Other', 2: 'Ok', 3: 'Degraded', 4: 'Failed'}
39 hp_blade_status2nagios_map = {
40 'Other': 2,
41 'Ok': 0,
42 'Degraded': 1,
43 'Failed': 2,
47 def inventory_hp_blade_general(info):
48 if len(info) > 0 and len(info[0]) > 1:
49 return [(None, None)]
52 def check_hp_blade_general(item, params, info):
53 snmp_state = hp_blade_status_map[int(info[0][1])]
54 status = hp_blade_status2nagios_map[snmp_state]
55 return (status,
56 "General Status is %s (Firmware: %s, S/N: %s)" % (snmp_state, info[0][0], info[0][2]))
59 check_info["hp_blade"] = {
60 'check_function': check_hp_blade_general,
61 'inventory_function': inventory_hp_blade_general,
62 'service_description': 'General Status',
63 'snmp_info': ('.1.3.6.1.4.1.232.22.2.3.1.1.1', ['8', '16', '7']),
64 'snmp_scan_function': lambda oid: ".11.5.7.1.2" in oid(".1.3.6.1.2.1.1.2.0"),