2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2016 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.4526.10.43.1.6.1.3.1.0 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.0
28 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.1.1 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.1
29 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.1.2 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.2
30 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.1.3 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.3
31 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.1.4 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.4
32 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.1.5 1 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.1.5
33 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.0 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.0
34 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.1 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.1
35 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.2 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.2
36 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.3 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.3
37 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.4 2 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.4
38 # .1.3.6.1.4.1.4526.10.43.1.6.1.3.2.5 1 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState.2.5
39 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.0 3950 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.0
40 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.1 3700 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.1
41 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.2 3600 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.2
42 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.3 3400 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.3
43 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.4 0 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.4
44 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.1.5 0 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.1.5
45 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.0 3650 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.0
46 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.1 3400 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.1
47 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.2 3300 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.2
48 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.3 3500 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.3
49 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.4 0 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.4
50 # .1.3.6.1.4.1.4526.10.43.1.6.1.4.2.5 0 --> FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed.2.5
53 factory_settings
["netgear_fans_default_levels"] = {
54 "lower": (1500, 1200),
58 def netgear_map_state_txt_to_int(state_nr
, version
):
59 map_state_txt_to_int
= {
69 if version
.startswith("8."):
77 elif version
.startswith("10."):
94 state_txt
= map_states
.get(state_nr
, "unknown(%s)" % state_nr
)
95 return map_state_txt_to_int
.get(state_txt
, 3), state_txt
98 def parse_netgear_fans(info
):
99 versioninfo
, sensorinfo
= info
100 if versioninfo
== []:
101 parsed
= {"__fans__": {}}
104 "__version__": versioninfo
[0][0],
107 for oid_end
, sstate
, reading_str
in sensorinfo
:
108 parsed
["__fans__"].setdefault("%s" % oid_end
.replace(".", "/"), {
110 "reading_str": reading_str
,
115 def inventory_netgear_fans(parsed
):
116 for sensorname
, sensorinfo
in parsed
["__fans__"].items():
117 state
= sensorinfo
["state"]
118 if state
!= "1" and not ( state
== "2" and \
119 sensorinfo
["reading_str"] in [ "0" ] ):
123 def check_netgear_fans(item
, params
, parsed
):
124 data
= parsed
["__fans__"].get(item
)
128 reading_str
= data
["reading_str"]
129 if reading_str
!= "Not Supported":
130 yield check_fan(int(data
["reading_str"]), params
)
131 state
, state_readable
= netgear_map_state_txt_to_int(data
["state"], parsed
.get(
133 yield state
, "Status: %s" % state_readable
136 check_info
['netgear_fans'] = {
137 'parse_function': parse_netgear_fans
,
138 'inventory_function': inventory_netgear_fans
,
139 'check_function': check_netgear_fans
,
140 'service_description': 'Fan %s',
142 ('.1.3.6.1.4.1.4526.10.1.1.1.13', ['']),
144 '.1.3.6.1.4.1.4526.10.43.1.6.1',
147 "3", # FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanItemState
148 "4", # FASTPATH-BOXSERVICES-PRIVATE-MIB::boxServicesFanSpeed
151 'snmp_scan_function': lambda oid
: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.4526.100"),
152 'default_levels_variable': 'netgear_fans_default_levels',
153 'includes': ['fan.include'],