Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit e5f1a99c authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

Delete checkpoint_fw_connections

parent 4b583581
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2018-03-17
# #
# rewrite of the original checkpoint_connections check from check_mk
#
# added connection statistic details for tcp/udp/icmp/other .....
#
# 29.05.2018 : added connection limit (fwConnTableLimit)
# 31.05.2020 : changed form checkpoint_connections to checkpoint_fw_connections
# changed to checkpoint_fw_connections_default_levels to
# factory_settings['checkpoint_fw_connections_defaults']
# 07.06.2020 : code cleanup
# added wato
# wadded warn/crit for connection rate
# 08.06.2020: changed snmp-scan function
# code cleanup
#
# sample info
# [[[u'559684419', u'203840211', u'51093794', u'786231', u'815404655', u'0']], [[u'11172', u'27598', u'0']]]
#
# no firewall
# [[], []]
#
factory_settings['checkpoint_fw_connections_defaults'] = {
# 'warncritcurrent': (1000, 2000),
# 'warncritnew': (100, 200)
}
def inventory_checkpoint_fw_connections(info):
if info != [[], []]:
return [(None, None)]
def check_checkpoint_fw_connections(item, params, info):
fwConnectionsStat, fwpolicystat = info
fwConnectionsTcp, fwConnectionsUdp, fwConnectionsIcmp, fwConnectionsOther, fwConnectionsSum, fwConnectionRate = fwConnectionsStat[0]
fwCurrnetNumConn, fwPeakNumConn, fwConnTableLimit = fwpolicystat[0]
fwConnectionRate = int(fwConnectionRate)
fwCurrnetNumConn = int(fwCurrnetNumConn)
fwPeakNumConn = int(fwPeakNumConn)
fwConnTableLimit = int (fwConnTableLimit)
if fwConnTableLimit == 0:
fwConnTableLimit = 'automatically adjusted'
for info, unit, counter, value, warncrit in [
('current: ', '', 'fwcurrentnumconn', fwCurrnetNumConn, 'warncritcurrent'),
('rate: ', '/s', 'fwconnectionrate', fwConnectionRate, 'warncritrate')
]:
if params.get(warncrit):
warn, crit = params[warncrit]
else:
warn = None
crit = None
infotext = info + '%d' % value + unit
perfdata = [(counter, value, warn, crit)]
if crit != None and value >= crit:
yield 2, infotext + ' (>=%d)' % crit, perfdata
elif warn != None and value >= warn:
yield 1, infotext + ' (>=%d)' % warn, perfdata
else:
yield 0, infotext, perfdata
infotext = 'peak: %d, table limit: %s' % (fwPeakNumConn, fwConnTableLimit)
perfdata = [('fwpeaknumconn', fwPeakNumConn)]
now_time = time.time()
for counter, value in [
('fwconnectionstcp', fwConnectionsTcp),
('fwconnectionsudp', fwConnectionsUdp),
('fwconnectionsicmp', fwConnectionsIcmp),
('fwconnectionsother', fwConnectionsOther),
('fwconnectionssum', fwConnectionsSum),
]:
value = get_rate('checkpoint_fw_connections.%s' % counter, now_time, int(value), onwrap=SKIP)
perfdata.append((counter, value))
yield 0, infotext , perfdata
check_info['checkpoint_fw_connections'] = {
'check_function': check_checkpoint_fw_connections,
'inventory_function': inventory_checkpoint_fw_connections,
'service_description': 'Firewall connections',
'has_perfdata': True,
'group': 'checkpoint_fw_connections',
'default_levels_variable': 'checkpoint_fw_connections_defaults',
'snmp_scan_function': lambda oid: (oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.2620.1.6.123.1') or
oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.8072.3.2.10')) and
oid('.1.3.6.1.4.1.2620.1.6.1.0', '').lower().startswith('svn foundation'),
'snmp_info': [('.1.3.6.1.4.1.2620.1.1.26.11', [ # CHECKPOINT-MIB::fwConnectionsStat
'1', # fwConnectionsStatConnectionsTcp
'2', # fwConnectionsStatConnectionsUdp
'3', # fwConnectionsStatConnectionsIcmp
'4', # fwConnectionsStatConnectionsOther
'5', # fwConnectionsStatConnections
'6', # fwConnectionsStatConnectionRate
]),
('.1.3.6.1.4.1.2620.1.1.25', [ # CHECKPOINT-MIB::fwPolicyStat
'3', # fwNumConn
'4', # fwPeakNumConn
'10', # fwConnTableLimit
])
]
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment