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.
28 def perle_scan_function(oid
):
29 return oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.1966.20')
32 def perle_check_alarms(alarms_str
):
35 if int(alarms_str
) > 0:
37 alarminfo
+= " (User intervention is needed to resolve the outstanding alarms)"
39 return state
, "Alarms: %s%s" % (alarms_str
, alarminfo
)
42 # .--modules-------------------------------------------------------------.
44 # | _ __ ___ ___ __| |_ _| | ___ ___ |
45 # | | '_ ` _ \ / _ \ / _` | | | | |/ _ \/ __| |
46 # | | | | | | | (_) | (_| | |_| | | __/\__ \ |
47 # | |_| |_| |_|\___/ \__,_|\__,_|_|\___||___/ |
49 # '----------------------------------------------------------------------'
52 def inventory_perle_cm_modules(info
):
54 for _name
, _led
, index
, \
55 _fiber_lprf
, _fiber_link
, _fiber_conn
, _fiber_speed
, \
56 _cooper_lprf
, _copper_link
, _copper_conn
, _copper_speed
in info
:
57 inventory
.append((index
, None))
61 def check_perle_cm_modules(item
, _no_params
, info
):
70 "1": (0, "power to the module"),
71 "2": (0, "loopback enabled"),
76 "2": (2, "link fault"),
77 "3": (2, "auto neg error"),
78 # available for cm1110 modules
79 "99": (2, "not applicable"),
95 "1": (2, "remote fault"),
101 "copper_connector": {
106 for _name
, power_led
, index
, \
107 fiber_lprf
, fiber_link
, fiber_connector
, fiber_speed
, \
108 cooper_lprf
, copper_link
, copper_connector
, copper_speed
in info
:
110 state
, state_readable
= mappings
["power_led"][power_led
]
111 yield state
, "Power status: %s" % state_readable
113 for what
, lprf
, link
, speed
, connector
in [("Fiber", fiber_lprf
, fiber_link
,
114 fiber_speed
, fiber_connector
),
115 ("Copper", cooper_lprf
, copper_link
,
116 copper_speed
, copper_connector
)]:
118 yield 0, "%s Speed: %s" % (what
, mappings
["speed"][speed
])
120 for what_state
, what_key
in [(lprf
, "LPRF"), (link
, "Link")]:
121 state
, state_readable
= mappings
["%s_%s" % (what
.lower(),
122 what_key
.lower())][what_state
]
123 yield state
, "%s: %s" % (what_key
, state_readable
)
125 yield 0, "Connector: %s" % mappings
["%s_connector" % what
.lower()][connector
]