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 f17678b2 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

cleanup

parents
No related branches found
No related tags found
No related merge requests found
# Check Point connections
Monitors the connections thru a Check Point gateway
Check Info:
* *service*: this check will create the service *Connections*
* *state*: **critical**/**warning** if the number of connections outside the configured levels
* *wato*: none
* *perfdata*:
* TCP connections/s
* UDP connections/s
* ICMP connections/s
* Other connections/s
* Total connections/s
* Connections rate/s
* Current connections
* Peak Connections
Sample output
![sample output](/doc/sample.png?raw=true "sample [SHORT TITLE]")
File added
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
# rewrite of the original checkpoint_connections check from check_mk
#
# Author: Th.L.
# Date : 2018-03-17
#
# added connection statistic details for tcp/udp/icmp/other .....
#
# 29.05.208 : added connection limit (fwConnTableLimit)
#
checkpoint_connections_default_levels = (40000, 50000)
def inventory_checkpoint_connections(info):
return [(None, 'checkpoint_connections_default_levels')]
def check_checkpoint_connections(item, params, info):
fwConnectionsStat, fwpolicystat = info
fwConnectionsTcp, fwConnectionsUdp, fwConnectionsIcmp, fwConnectionsOther, fwConnections, fwConnectionRate = fwConnectionsStat[0]
fwNumConn, fwPeakNumConn, fwConnTableLimit = fwpolicystat[0]
now_time = time.time()
fwConnectionsTcp = get_rate('checkpoint_connections.%s.%s' % ('fwConnectionsTcp', item), now_time, int(fwConnectionsTcp), onwrap=SKIP)
fwConnectionsUdp = get_rate('checkpoint_connections.%s.%s' % ('fwConnectionsUdp', item), now_time, int(fwConnectionsUdp), onwrap=SKIP)
fwConnectionsIcmp = get_rate('checkpoint_connections.%s.%s' % ('fwConnectionsIcmp', item), now_time, int(fwConnectionsIcmp), onwrap=SKIP)
fwConnectionsOther = get_rate('checkpoint_connections.%s.%s' % ('fwConnectionsOther', item), now_time, int(fwConnectionsOther), onwrap=SKIP)
fwConnections = get_rate('checkpoint_connections.%s.%s' % ('fwConnections', item), now_time, int(fwConnections), onwrap=SKIP)
fwConnectionRate = int(fwConnectionRate)
fwNumConn = int(fwNumConn)
fwPeakNumConn = int(fwPeakNumConn)
fwConnTableLimit = int (fwConnTableLimit)
warn, crit = params
perfdata = [('fwconnectionstcp', fwConnectionsTcp),
('fwconnectionsudp', fwConnectionsUdp),
('fwconnectionsicmp', fwConnectionsIcmp),
('fwconnectionsother', fwConnectionsOther),
('fwconnections', fwConnections),
('connections', fwNumConn, warn, crit, 0, fwConnTableLimit),
('fwpeaknumconn', fwPeakNumConn)
]
state = 0
infotext = ''
infotext += '%d current' % fwNumConn
infotext += ', %d peak' % fwPeakNumConn
infotext += ', %d table limit' % fwConnTableLimit
infotext += ', %d rate' % fwConnectionRate
if fwConnections >= crit:
state = 2
elif fwConnections >= warn:
state = 1
if state > 0:
infotext += ' (warn/crit at %d/%d)' % (warn, crit)
return state, infotext, perfdata
check_info['checkpoint_connections'] = {
'check_function' : check_checkpoint_connections,
'inventory_function' : inventory_checkpoint_connections,
'service_description': 'Connections',
'has_perfdata' : True,
'group' : 'checkpoint_connections',
#'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0') in ['.1.3.6.1.4.1.2620.1.6.123.1.67', # ClusterXL Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.65', # Appliance
# '.1.3.6.1.4.1.2620.1.6.123.1.64', # VSX Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.62', # Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.49', # R77.30 Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.48', # Mgmt
# '.1.3.6.1.4.1.8072.3.2.10'] # Virtual System (Linux),
'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') in ['.1.3.6.1.4.1.8072.3.2.10',]) # Virtual System (Linux)
and oid('.1.3.6.1.4.1.2620.1.1.26.11.1.0'), # CHECKPOINT-MIB::fwConnectionsStatConnectionsTcp.0
'snmp_info' : [('.1.3.6.1.4.1.2620.1.1.26.11', [
'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
])
]
}
doc/sample.png

172 KiB

{'author': u'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': u'Monitor Check Point Firewall connection statistics.\n\nRewrite of the original check.\nAdded perfdata for peak connections and TCP, UDP, ICMP, other and total connection rate\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'checks': ['checkpoint_connections'],
'web': ['plugins/metrics/checkpoint_connections.py']},
'name': 'checkpoint_connections',
'num_files': 2,
'title': u'Check Point Connections',
'version': '20180731.v.0.0.1',
'version.min_required': '1.2.8b8',
'version.packaged': '1.4.0p35'}
\ No newline at end of file
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# Check Point Firewall connections metrics plugins
# checkpoint_connections
#
# Author: Th.L.
# Date : 2018-03-17
#
#####################################################################################################################
#
# define units for perfdata
#
#####################################################################################################################
#####################################################################################################################
#
# define metrics for perfdata
#
#####################################################################################################################
metric_info['checkpoint_connections_fwconnectionstcp'] = {
'title': _('TCP connections'),
'unit': '1/s',
'color': '11/a',
}
metric_info['checkpoint_connections_fwconnectionsudp'] = {
'title': _('UDP connections'),
'unit': '1/s',
'color': '21/a',
}
metric_info['checkpoint_connections_fwconnectionsicmp'] = {
'title': _('ICMP connections'),
'unit': '1/s',
'color': '31/a',
}
metric_info['checkpoint_connections_fwconnectionsother'] = {
'title': _('Other connections'),
'unit': '1/s',
'color': '41/a',
}
metric_info['checkpoint_connections_fwconnections'] = {
'title': _('Total connections'),
'unit': '1/s',
'color': '32/a',
}
metric_info['checkpoint_connections_fwconnectionrate'] = {
'title': _('Connections rate'),
'unit': '1/s',
'color': '42/a',
}
metric_info['checkpoint_connections_connections'] = {
'title': _('Current connections'),
'unit': 'count',
'color': '13/a',
}
metric_info['checkpoint_connections_fwpeaknumconn'] = {
'title': _('Peak Connections'),
'unit': 'count',
'color': '23/a',
}
######################################################################################################################
#
# map perfdata to metric
#
######################################################################################################################
check_metrics['check_mk-checkpoint_connections'] = {
'fwconnectionstcp': {'name': 'checkpoint_connections_fwconnectionstcp', },
'fwconnectionsudp': {'name': 'checkpoint_connections_fwconnectionsudp', },
'fwconnectionsicmp': {'name': 'checkpoint_connections_fwconnectionsicmp', },
'fwconnectionsother': {'name': 'checkpoint_connections_fwconnectionsother', },
'fwconnections': {'name': 'checkpoint_connections_fwconnections', },
'fwconnectionrate': {'name': 'checkpoint_connections_fwconnectionrate', },
'connections': {'name': 'checkpoint_connections_connections', },
'fwpeaknumconn': {'name': 'checkpoint_connections_fwpeaknumconn', },
}
######################################################################################################################
#
# how to graph perdata
#
######################################################################################################################
graph_info.append({
'title': _('Check Point Firewall Connections per second'),
'metrics': [
('checkpoint_connections_fwconnectionsother', 'stack'),
('checkpoint_connections_fwconnectionsicmp', 'stack'),
('checkpoint_connections_fwconnectionsudp', 'stack'),
('checkpoint_connections_fwconnectionstcp', 'stack'),
('checkpoint_connections_fwconnections', 'line'),
],
})
graph_info.append({
'title': _('Check Point Firewall Connections count'),
'metrics': [
('checkpoint_connections_fwpeaknumconn', 'line'),
('checkpoint_connections_connections', 'line'),
],
'scalars': [
('checkpoint_connections_connections:crit', _('crit')),
('checkpoint_connections_connections:warn', _('warn')),
],
})
######################################################################################################################
#
# define perf-o-meter
#
######################################################################################################################
perfometer_info.append(('stacked', [
{
'type': 'logarithmic',
'metric': 'checkpoint_connections_connections',
'half_value': 100000.0,
'exponent': 2,
},
{
'type': 'logarithmic',
'metric': 'checkpoint_connections_fwconnections',
'half_value': 1000.0,
'exponent': 2,
},
]))
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