2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2019 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_aos7_operability_to_status_mapping
= {
33 '6': "not present", # no check status required
40 alcatel_power_aos7_no_power_supply
= "no power supply"
42 alcatel_power_aos7_power_type_mapping
= {
43 '0': alcatel_power_aos7_no_power_supply
,
48 PowerSupplyEntry
= collections
.namedtuple('PowerSupplyEntry', 'status_readable power_supply_type')
51 def parse_alcatel_power_aos7(info
):
53 item
: PowerSupplyEntry(
54 alcatel_power_aos7_operability_to_status_mapping
[operability_status
],
55 alcatel_power_aos7_power_type_mapping
[power_supply_type
],
56 ) for (item
, operability_status
, power_supply_type
) in info
61 def inventory_alcatel_power_aos7(_oidend
, device
):
62 return (device
.power_supply_type
!= alcatel_power_aos7_no_power_supply
and
63 device
.status_readable
!= "not present")
67 def check_alcatel_power_aos7(item
, _no_params
, device
):
68 if device
.status_readable
== 'up':
72 yield status
, "[%s] Status: %s" % (device
.power_supply_type
, device
.status_readable
)
75 check_info
["alcatel_power_aos7"] = {
76 "parse_function": parse_alcatel_power_aos7
,
77 "check_function": check_alcatel_power_aos7
,
78 "inventory_function": inventory_alcatel_power_aos7
,
79 "service_description": "Power Supply %s",
80 "snmp_scan_function": alcatel_new_networking_products_scan_function
,
82 ".1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1", # MIB object "chasEntPhysicalEntry"
85 2, # MIB object "chasEntPhysOperStatus"
86 35, # MIB object "chasEntPhysPowerType"
88 "includes": ["alcatel.include"],