Cleanup config.nodes_of
[check_mk.git] / checks / checkpoint_packets
blob056aa587ebd65a41d387b74e826271d1b25a33ea
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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),
38 "espencrypted": (100000, 200000),
39 "espdecrypted": (100000, 200000),
43 def inventory_checkpoint_packets(info):
44 if info:
45 return [(None, {})]
48 def check_checkpoint_packets(_no_item, params, info):
49 if info:
50 value = {}
51 value["Accepted"] = int(info[0][0][0])
52 value["Rejected"] = int(info[0][0][1])
53 value["Dropped"] = int(info[0][0][2])
54 value["Logged"] = int(info[0][0][3])
55 value["EspEncrypted"] = int(info[1][0][0])
56 value["EspDecrypted"] = int(info[1][0][1])
57 this_time = time.time()
58 for name in value:
59 key = name.lower()
60 if params.get(key) is None:
61 warn, crit = (None, None)
62 else:
63 warn, crit = params[key]
65 rate = get_rate(key, this_time, value[name])
66 infotext = "%s: %.1f pkts/s" % (name, rate)
67 state = 0
68 if crit is not None and rate >= crit:
69 state = 2
70 elif warn is not None and rate >= warn:
71 state = 1
72 if state:
73 infotext += " (warn/crit at %s/%s pkts/s)" % (warn, crit)
75 yield state, infotext, [(key, rate, warn, crit, 0)]
78 check_info["checkpoint_packets"] = {
79 "check_function": check_checkpoint_packets,
80 "inventory_function": inventory_checkpoint_packets,
81 "service_description": "Packet Statistics",
82 "has_perfdata": True,
83 "group": "checkpoint_packets",
84 "snmp_scan_function": scan_checkpoint,
85 "default_levels_variable": "checkpoint_packets_default_levels",
86 "snmp_info": [
88 ".1.3.6.1.4.1.2620.1.1",
90 4, # fwAccepted
91 5, # fwRejected
92 6, # fwDropped
93 7, # fwLogged
94 ]),
96 ".1.3.6.1.4.1.2620.1.2.5.4",
98 5, # cpvIpsecEspEncPkts
99 6, # cpvIpsecEspDecPkts
102 "includes": ["checkpoint.include"],