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.
28 # - no camel case in check parameters
29 # - use friendly output of values. Output
30 # "Ingress Dequeue Packets" instead of "brcdTMStatsIngressDequeuePkts"
32 factory_settings
["brocade_tm_default_levels"] = {
33 'brcdTMStatsTotalIngressPktsCnt': (1000, 10000),
34 'brcdTMStatsIngressEnqueuePkts': (1000, 10000),
35 'brcdTMStatsEgressEnqueuePkts': (1000, 10000),
36 'brcdTMStatsIngressDequeuePkts': (1000, 10000),
37 'brcdTMStatsIngressTotalQDiscardPkts': (1000, 10000),
38 'brcdTMStatsIngressOldestDiscardPkts': (1000, 10000),
39 'brcdTMStatsEgressDiscardPkts': (1000, 10000),
43 def inventory_brocade_tm(info
):
46 inventory
.append((line
[0], None))
50 def check_brocade_tm(item
, params
, info
):
55 tm
['TotalIngressPktsCnt'] = line
[1]
56 tm
['IngressEnqueuePkts'] = line
[2]
57 tm
['EgressEnqueuePkts'] = line
[3]
58 tm
['IngressDequeuePkts'] = line
[4]
59 tm
['IngressTotalQDiscardPkts'] = line
[5]
60 tm
['IngressOldestDiscardPkts'] = line
[6]
61 tm
['EgressDiscardPkts'] = line
[7]
68 for name
, counter
in tm
.items():
69 rate
= get_rate("%s.%s" % (name
, item
), now
, int(counter
))
71 warn
, crit
= params
["brcdTMStats" + name
]
72 if re
.search("Discard", name
):
85 infotext
+= "%s: %.1f%s, " % (name
, rate
, sym
)
86 perfdata
.append((name
, rate
, warn
, crit
))
87 overall_state
= max(overall_state
, state
)
89 return (overall_state
, infotext
, perfdata
)
91 return (3, "Interface not found")
94 check_info
["brocade_tm"] = {
95 'check_function': check_brocade_tm
,
96 'inventory_function': inventory_brocade_tm
,
97 'service_description': 'TM %s',
99 'snmp_scan_function': lambda oid
: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1991.1."),
100 'group': 'brocade_tm',
101 'default_levels_variable': 'brocade_tm_default_levels',
103 ".1.3.6.1.4.1.1991.1.14.2.1.2.2.1",
105 3, # 'brcdTMStatsDescription',
106 4, # 'brcdTMStatsTotalIngressPktsCnt',
107 5, # 'brcdTMStatsIngressEnqueuePkts',
108 6, # 'brcdTMStatsEgressEnqueuePkts',
109 9, # 'brcdTMStatsIngressDequeuePkts',
110 11, # 'brcdTMStatsIngressTotalQDiscardPkts',
111 13, # 'brcdTMStatsIngressOldestDiscardPkts',
112 15, # 'brcdTMStatsEgressDiscardPkts',