2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2018 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 alcatel_cpu_default_levels
= (90.0, 95.0)
29 factory_settings
['alcatel_temp'] = {
34 def alcatel_networking_products_scan_function(oid
):
36 Devices running until AOS6 (including).
38 sys_object_id
= ".1.3.6.1.2.1.1.2.0" # MIB object "sysObjectID"
39 alcatel_ind_1_base_mib
= ".1.3.6.1.4.1.6486.800" # MIB object "alcatelIND1BaseMIB"
40 return oid(sys_object_id
).startswith(alcatel_ind_1_base_mib
)
43 def alcatel_new_networking_products_scan_function(oid
):
45 Devices running at least AOS7 (including).
46 Refer to alcatelENT1BaseMIB for more information.
48 sys_object_id
= ".1.3.6.1.2.1.1.2.0" # MIB object "sysObjectID"
49 alcatel_ent_1_base_mib
= ".1.3.6.1.4.1.6486.801" # MIB object "alcatelENT1BaseMIB"
50 return oid(sys_object_id
).startswith(alcatel_ent_1_base_mib
)
53 def inventory_alcatel_cpu(info
):
54 return [(None, "alcatel_cpu_default_levels")]
57 def check_alcatel_cpu(_no_item
, params
, info
):
58 cpu_perc
= int(info
[0][0])
64 elif cpu_perc
>= warn
:
67 levelstext
= " (warn/crit at %.1f%%/%.1f%%)" % (warn
, crit
)
68 perfdata
= [("util", cpu_perc
, warn
, crit
, 0, 100)]
69 return status
, "total: %.1f%%" % cpu_perc
+ levelstext
, perfdata
72 def inventory_alcatel_fans(info
):
73 for nr
, _value
in enumerate(info
, 1):
77 def check_alcatel_fans(item
, _no_params
, info
):
84 line
= info
[int(item
) - 1]
85 fan_state
= int(line
[0])
86 except (ValueError, IndexError):
89 state
= 0 if fan_state
== 2 else 2
90 return state
, "Fan " + fan_states
.get(fan_state
, "unknown (%s)" % fan_state
)
93 def inventory_alcatel_temp(info
):
94 with_slot
= len(info
) != 1
95 for index
, row
in enumerate(info
):
96 for oid
, name
in enumerate(["Board", "CPU"]):
99 yield "Slot %s %s" % (index
+ 1, name
), {}
104 def check_alcatel_temp(item
, params
, info
):
108 slot
= int(item
.split()[1])
109 slot_index
= slot
- 1
110 sensor
= item
.split()[-1]
111 items
= {"Board": 0, "CPU": 1}
113 # If multiple switches are staked and one of them are
114 # not reachable, prevent a exception
115 temp_celsius
= int(info
[slot_index
][items
[sensor
]])
117 return 3, "Sensor not found"
118 return check_temperature(temp_celsius
, params
, "alcatel_temp_%s" % item
)