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 alcatel_power_operstate_map
= {
38 alcatel_power_no_power_supply_info
= "no power supply"
40 alcatel_power_type_map
= {
41 "0": alcatel_power_no_power_supply_info
,
46 AlcatelPowerEntry
= collections
.namedtuple("AlcatelPowerEntry", [
47 "oper_state_readable",
52 def parse_alcatel_power(info
):
54 for oidend
, status
, power_type
in info
:
58 alcatel_power_operstate_map
.get(status
, 'unknown[%s]' % status
),
59 alcatel_power_type_map
.get(power_type
, alcatel_power_no_power_supply_info
),
65 def inventory_alcatel_power(_oidend
, device
):
66 return (device
.power_type
!= alcatel_power_no_power_supply_info
and
67 device
.oper_state_readable
!= 'not present')
71 def check_alcatel_power(item
, _no_params
, device
):
72 if device
.oper_state_readable
== 'up':
76 yield state
, "[%s] Operational status: %s" % (device
.power_type
, device
.oper_state_readable
)
79 check_info
["alcatel_power"] = {
80 "parse_function": parse_alcatel_power
,
81 "check_function": check_alcatel_power
,
82 "inventory_function": inventory_alcatel_power
,
83 "service_description": "Power Supply %s",
84 "snmp_scan_function": alcatel_networking_products_scan_function
,
86 ".1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1", # MIB object "chasEntPhysicalEntry"
89 2, # MIB object "chasEntPhysOperStatus":
90 # up(1), down(2), testing(3), unknown(4),
91 # secondary(5), notPresent(6), unpowered(7), master(9)
92 36, # MIB object "chasEntPhysPowerType":
93 # 0 no power supply, 1 ac, 2 dc (not available on old devices)
95 "includes": ["alcatel.include"],