2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2017 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 #TODO states, traffic, params?
30 def check_mcafee_emailgateway_bridge(item
, params
, info
):
31 bridge_present
, bridge_state
, tcp_packets
, udp_packets
, icmp_packets
= info
[0]
32 if bridge_present
== "0":
34 state_readable
= "present"
37 state_readable
= "not present"
38 yield state
, "Bridge: %s" % state_readable
40 if bridge_state
== "0":
45 state_readable
= "down"
46 yield state
, "Status: %s" % state_readable
49 for title
, packets
in [
52 ("ICMP", icmp_packets
),
55 packets_rate
= get_rate("mcafee_emailgateway_bridge.%s" % key
, now
, int(packets
))
56 perfdata
= ["%s_packets_received" % key
, packets_rate
]
57 infotext
= "%s: %.2f packets received/s" % (title
, packets_rate
)
60 warn
, crit
= params
[key
]
61 perfdata
+= [warn
, crit
]
62 if packets_rate
>= crit
:
64 elif packets_rate
>= warn
:
67 infotext
+= " (warn/crit at %s/%s packets/s)" % (warn
, crit
)
68 yield state
, infotext
, [tuple(perfdata
)]
71 check_info
['mcafee_emailgateway_bridge'] = {
72 'inventory_function': inventory_mcafee_gateway_generic
,
73 'check_function': check_mcafee_emailgateway_bridge
,
74 'service_description': 'Bridge',
76 '.1.3.6.1.4.1.1230.2.4.1.2.2.1',
78 '1', # wsnat-BridgePresent
80 '3', # wsnat-TcpTraffic
81 '4', # wsnat-UdpTraffic
82 '5', # wsnat-IcmpTraffic
84 'snmp_scan_function': scan_mcafee_emailgateway
,
85 'includes': ['mcafee_gateway.include'],
86 'group': 'mcafee_emailgateway_bridge',