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 adva_fsp_if_inventory_porttypes
= ['1', '6', '56']
28 adva_fsp_if_inventory_portstates
= ['1']
29 adva_fsp_if_inventory_uses_description
= True
30 adva_fsp_if_inventory_uses_alias
= False
32 adva_fsp_if_operstates
= {
38 "6": ("notPresent", 2),
39 "7": ("lowerLayerDown", 2),
42 adva_fsp_if_adminstates
= {
49 @network_interface_scan_registry.register
50 def snmp_scan_function_adva_fsp_if(oid
):
51 return oid(".1.3.6.1.2.1.1.1.0") == "Fiber Service Platform F7"
54 def inventory_adva_fsp_if(info
):
57 if line
[2] in adva_fsp_if_inventory_porttypes
and line
[
58 3] in adva_fsp_if_inventory_portstates
:
59 if adva_fsp_if_inventory_uses_description
and line
[1] != "":
61 elif adva_fsp_if_inventory_uses_alias
and line
[5] != "":
65 inventory
.append((item
, {}))
69 def adva_fsp_if_getindex(item
, info
):
71 if adva_fsp_if_inventory_uses_description
:
74 elif adva_fsp_if_inventory_uses_alias
:
81 def check_adva_fsp_if(item
, params
, info
):
82 index
= adva_fsp_if_getindex(item
, info
)
86 admintxt
, adminstate
= adva_fsp_if_adminstates
[line
[3]]
87 state
= max(adminstate
, state
)
88 opertxt
, operstate
= adva_fsp_if_operstates
[line
[4]]
89 state
= max(operstate
, state
)
96 infotext
= "Admin/Operational State: %s/%s %s" % (admintxt
, opertxt
, statesym
)
99 for power
, name
in [(line
[6], "output"), (line
[7], "input")]:
103 fpower
= float(power
) / 10.0
104 if params
.get("limits_%s_power" % name
):
105 lower
, upper
= params
.get("limits_%s_power" % name
)
106 climits
= "%s:%s" % params
.get("limits_%s_power" % name
)
107 if fpower
< lower
or fpower
> upper
:
110 infotext
+= ", %s Power: %.1f%s" % (name
.title(), fpower
, sym
)
111 perfdata
.append(("%s_power" % name
, "%.1fdBm" % fpower
, "", climits
))
114 if not re
.match("S", item
): # if no service interface and no power parameter
115 infotext
+= ", %s Power: n.a. (!)" % name
.title()
116 state
= max(1, state
)
118 return (state
, infotext
, perfdata
)
120 return (3, "no such interface found")
123 check_info
['adva_fsp_if'] = {
124 "inventory_function": inventory_adva_fsp_if
,
125 "check_function": check_adva_fsp_if
,
126 "service_description": 'Interface %s',
127 "has_perfdata": True,
132 "2.1.2.2.1.1", # ifIndex
133 "2.1.2.2.1.2", # ifDescr
134 "2.1.2.2.1.3", # ifType
135 "2.1.2.2.1.7", # ifAdminStatus
136 "2.1.2.2.1.8", # ifOperStatus
137 "31.1.1.1.18", # ifAlias
138 "4.1.2544.1.11.2.4.3.5.1.4", # opticalIfDiagOutputPower
139 "4.1.2544.1.11.2.4.3.5.1.3", # opticalIfDiagInputPower
142 "includes": ["if.include"],
143 "snmp_scan_function": snmp_scan_function_adva_fsp_if
,