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>
30 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.1 1
31 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.2 2
32 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.3 3
33 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.4 4
34 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.1 SNMPv2-SMI::enterprises.11.2.3.7.8.3.2
35 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.2 SNMPv2-SMI::enterprises.11.2.3.7.8.3.1
36 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.3 SNMPv2-SMI::enterprises.11.2.3.7.8.3.1
37 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.4 SNMPv2-SMI::enterprises.11.2.3.7.8.3.3
38 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.1 1
39 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.2 1
40 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.3 1
41 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.4 1
42 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.1 4
43 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.2 4
44 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.3 5
45 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.4 4
46 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.1 0
47 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.2 0
48 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.3 0
49 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.4 0
50 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.1 0
51 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.2 0
52 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.3 0
53 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.4 0
54 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.1 "Fan Sensor"
55 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.2 "Power Supply Sensor"
56 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.3 "Redundant Power Supply Sensor"
57 # .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.4 "Over-temperature Sensor"
68 hp_procurve_status_map
= {
75 hp_procurve_status2nagios_map
= {'unknown': 3, 'bad': 2, 'warning': 1, 'good': 0, 'notPresent': 1}
78 def get_hp_procurve_sensor_type(type_input
):
80 if type_input
.endswith('11.2.3.7.8.3.1'):
82 elif type_input
.endswith('11.2.3.7.8.3.2'):
84 elif type_input
.endswith('11.2.3.7.8.3.3'):
86 elif type_input
.endswith('11.2.3.7.8.3.4'):
91 def inventory_hp_procurve_sensors(info
):
94 if len(line
) == 4 and hp_procurve_status_map
[line
[2]] != 'notPresent':
95 inventory
.append((line
[0], None))
99 def check_hp_procurve_sensors(item
, _not_used
, info
):
102 procurve_status
= hp_procurve_status_map
[line
[2]]
103 status
= hp_procurve_status2nagios_map
[procurve_status
]
105 return (status
, 'Condition of %s "%s" is %s' % (get_hp_procurve_sensor_type(line
[1]),
106 line
[3], procurve_status
))
107 return (3, "item not found in snmp data")
110 check_info
["hp_procurve_sensors"] = {
111 'check_function': check_hp_procurve_sensors
,
112 'inventory_function': inventory_hp_procurve_sensors
,
113 'service_description': 'Sensor %s',
114 'snmp_info': ('.1.3.6.1.4.1.11.2.14.11.1.2.6.1', ['1', '2', '4', '7']),
115 'snmp_scan_function': lambda oid
: ".11.2.3.7.11" in oid(".1.3.6.1.2.1.1.2.0") or ".11.2.3.7.8"
116 in oid(".1.3.6.1.2.1.1.2.0"),