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 # .1.3.6.1.2.1.1.1.0 Linux gateway1 2.6.18-92cp #1 SMP Tue Dec 4 21:44:22 IST 2012 i686
28 # .1.3.6.1.4.1.2620.1.1.4.0 131645
29 # .1.3.6.1.4.1.2620.1.1.5.0 0
30 # .1.3.6.1.4.1.2620.1.1.6.0 1495
31 # .1.3.6.1.4.1.2620.1.1.7.0 16297
33 factory_settings
["checkpoint_packets_default_levels"] = {
34 "accepted": (100000, 200000),
35 "rejected": (100000, 200000),
36 "dropped": (100000, 200000),
37 "logged": (100000, 200000),
40 def inventory_checkpoint_packets(info
):
44 def check_checkpoint_packets(_no_item
, params
, info
):
47 value
["Accepted"] = int(info
[0][0])
48 value
["Rejected"] = int(info
[0][1])
49 value
["Dropped"] = int(info
[0][2])
50 value
["Logged"] = int(info
[0][3])
52 this_time
= time
.time()
53 for name
, val
in value
.iteritems():
55 if params
.get(key
) is None:
56 warn
, crit
= (None, None)
58 warn
, crit
= params
[key
]
60 rate
= get_rate(key
, this_time
, val
)
61 infotext
= "%s: %.1f pkts/s" % ( name
, rate
)
63 if crit
is not None and rate
>= crit
:
65 elif warn
is not None and rate
>= warn
:
68 infotext
+= " (warn/crit at %s/%s pkts/s)" % (warn
, crit
)
70 yield state
, infotext
, [ (key
, rate
, warn
, crit
, 0) ]
73 check_info
["checkpoint_packets"] = {
74 "check_function" : check_checkpoint_packets
,
75 "inventory_function" : inventory_checkpoint_packets
,
76 "service_description" : "Packet Statistics",
77 "has_perfdata" : True,
78 "group" : "checkpoint_packets",
79 "snmp_scan_function" : scan_checkpoint
,
80 "default_levels_variable" : "checkpoint_packets_default_levels",
81 "snmp_info" : ( ".1.3.6.1.4.1.2620.1.1",
87 "includes" : [ "checkpoint.include" ],