diff --git a/CHANGELOG b/CHANGELOG index 6e98a3647128891d9020ca50af471aec10a6cdc0..31252d38ac236ea8e73ea89c13a8215c680e940b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,3 +9,4 @@ 2020-06-08: changed snmp-scan function code cleanup 2022-11-30: WATO: fixed CheckParameterRulespecWithoutItem (from CheckParameterRulespecWithItem) +2023-03-04: changed for CMK 2.1 (moved gui files from local/share/.. to local/lib/..) diff --git a/agent_based/checkpoint_fw_connections.py b/agent_based/checkpoint_fw_connections.py index 4f07e0ad50af0371f362de6fab3f4b04e33873f0..ea85933f7e397df1b9791d5522f29e9b09bcd594 100644 --- a/agent_based/checkpoint_fw_connections.py +++ b/agent_based/checkpoint_fw_connections.py @@ -20,6 +20,7 @@ # 2021-08-24: rewritten for CMK 2.0, # added relative thresholds (idea and code based on cmk PR #312 by https://github.com/gradecke) # added lower levels and admin_table_limit, removed default values except for 'levels_upper_relative' +# 2023-03-04: changed for CMK 2.1 (moved gui files from local/share/.. to local/lib/..) # # # sample string_table diff --git a/checkpoint_fw_connections.mkp b/checkpoint_fw_connections.mkp index bacbe9fe31da4add1d2a3185d8eb0c73a6fadc27..4201b73e6891a94f92edcd26745ba6f61638831e 100644 Binary files a/checkpoint_fw_connections.mkp and b/checkpoint_fw_connections.mkp differ diff --git a/gui/metrics/checkpoint_fw_connections.py b/gui/metrics/checkpoint_fw_connections.py new file mode 100644 index 0000000000000000000000000000000000000000..62d926b0ed1ee70bd473a48de42ad41061ba0f7d --- /dev/null +++ b/gui/metrics/checkpoint_fw_connections.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# License: GNU General Public License v2 +# +# Author: thl-cmk[at]outlook[dot]com +# URL : https://thl-cmk.hopto.org +# Date : 2018-03-17 +# +# Check Point Firewall connections metrics plugins +# checkpoint_fw_connections +# +# 2023-02-18: moved metrics file from ~/local/share/check_mk/... to ~/local/lib/check_mk/... +# + +from cmk.gui.i18n import _ + +from cmk.gui.plugins.metrics.utils import ( + metric_info, + graph_info, + perfometer_info, +) + +metric_info['checkpoint_fw_connections_fwconnectionstcp'] = { + 'title': _('TCP connections'), + 'unit': '1/s', + 'color': '11/a', +} +metric_info['checkpoint_fw_connections_fwconnectionsudp'] = { + 'title': _('UDP connections'), + 'unit': '1/s', + 'color': '25/a', +} +metric_info['checkpoint_fw_connections_fwconnectionsicmp'] = { + 'title': _('ICMP connections'), + 'unit': '1/s', + 'color': '31/a', +} +metric_info['checkpoint_fw_connections_fwconnectionsother'] = { + 'title': _('Other connections'), + 'unit': '1/s', + 'color': '41/a', +} +metric_info['checkpoint_fw_connections_fwconnectionssum'] = { + 'title': _('Total connections'), + 'unit': '1/s', + 'color': '15/a', +} +metric_info['checkpoint_fw_connections_fwconnectionrate'] = { + 'title': _('Connections rate'), + 'unit': '1/s', + 'color': '22/a', +} + +metric_info['checkpoint_fw_connections_fwcurrentnumconn'] = { + 'title': _('Current connections'), + 'unit': 'count', + 'color': '26/a', +} +metric_info['checkpoint_fw_connections_fwpeaknumconn'] = { + 'title': _('Peak Connections'), + 'unit': 'count', + 'color': '16/a', +} + +metric_info['checkpoint_fw_connections_relative'] = { + 'title': _('Connections relative'), + 'unit': '%', + 'color': '36/a', +} + +graph_info['checkpoint_fw_connections_fwpeaknumconn'] = { + 'title': _('Check Point Firewall Connections absolute'), + 'metrics': [ + ('checkpoint_fw_connections_fwcurrentnumconn', 'area'), + ('checkpoint_fw_connections_fwpeaknumconn', 'line'), + ], + 'scalars': [ + ('checkpoint_fw_connections_fwcurrentnumconn:crit', _('crit')), + ('checkpoint_fw_connections_fwcurrentnumconn:warn', _('warn')), + ], +} + +graph_info['checkpoint_fw_connections_relative'] = { + 'title': _('Check Point Firewall Connections relative to connection table limit'), + 'metrics': [ + ('checkpoint_fw_connections_relative', 'area'), + ], + 'scalars': [ + ('checkpoint_fw_connections_relative:crit', _('crit')), + ('checkpoint_fw_connections_relative:warn', _('warn')), + ], + 'range': (0, 110), +} + +graph_info['checkpoint_fw_connections_fwconnectionstcp'] = { + 'title': _('Check Point Firewall Connections per second'), + 'metrics': [ + ('checkpoint_fw_connections_fwconnectionsother', 'stack'), + ('checkpoint_fw_connections_fwconnectionsicmp', 'stack'), + ('checkpoint_fw_connections_fwconnectionsudp', 'stack'), + ('checkpoint_fw_connections_fwconnectionstcp', 'stack'), + ('checkpoint_fw_connections_fwconnectionssum', 'line'), + ('checkpoint_fw_connections_fwconnectionrate', 'line'), + ], +} + +perfometer_info.append(('stacked', [ + { + 'type': 'linear', + 'segments': ['checkpoint_fw_connections_relative'], + 'total': 100, + }, + { + 'type': 'logarithmic', + 'metric': 'checkpoint_fw_connections_fwconnectionrate', + 'half_value': 1000.0, + 'exponent': 2, + }, +])) + +perfometer_info.append(('stacked', [ + { + 'type': 'logarithmic', + 'metric': 'checkpoint_fw_connections_fwcurrentnumconn', + 'half_value': 100000.0, + 'exponent': 2, + }, + { + 'type': 'logarithmic', + 'metric': 'checkpoint_fw_connections_fwconnectionrate', + 'half_value': 1000.0, + 'exponent': 2, + }, +])) diff --git a/gui/wato/checkpoint_fw_connections.py b/gui/wato/checkpoint_fw_connections.py new file mode 100644 index 0000000000000000000000000000000000000000..d72a8a20ac57649987efeb739f96396d42e39465 --- /dev/null +++ b/gui/wato/checkpoint_fw_connections.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# License: GNU General Public License v2 +# +# Author: thl-cmk[at]outlook[dot]com +# URL : https://thl-cmk.hopto.org +# Date : 2020-06-07 +# +# 2023-02-18: moved wato file from ~/local/share/check_mk/... to ~/local/lib/check_mk/... +# + + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Tuple, + Integer, + Percentage, +) +from cmk.gui.plugins.wato.utils import ( + CheckParameterRulespecWithItem, + rulespec_registry, + RulespecGroupCheckParametersNetworking, +) + + +def _parameter_valuespec_checkpoint_fw_connections(): + return Dictionary( + elements=[ + ('levels_upper_absolute', + Tuple( + title=_('Maximum number of firewall connections'), + help=_('This rule sets upper limits to the current number of connections through ' + 'a Checkpoint firewall.'), + elements=[ + Integer(title=_('Warning at'), minvalue=0, unit=_('connections')), + Integer(title=_('Critical at'), minvalue=0, unit=_('connections')), + ])), + ('levels_lower_absolute', + Tuple( + title=_('Minimum number of firewall connections'), + help=_('This rule sets lower limits to the current number of connections through ' + 'a Checkpoint firewall.'), + elements=[ + Integer(title=_('Warning blow'), minvalue=0, unit=_('connections')), + Integer(title=_('Critical below'), minvalue=0, unit=_('connections')), + ])), + ('admin_table_limit', + Integer( + title=_('Admin connection table limit'), + help=_('This rule sets the maximum number of connections through the firewall. This is use full ' + 'if your firewall is set to automatic connection table limit and you still want ' + 'relative metrics. This setting takes precedence over the the fwConnTableLimit ' + 'configured on the firewall (only for monitoring purposes of curse). This value should match' + 'the real values of your firewall, if not you might get relative values above 100%.'), + minvalue=0, + unit=_('connections'), + )), + ('levels_upper_relative', + Tuple( + title=_('Percentage of maximum connections (only used if a limit is defined on ' + 'the Check Point device)'), + help=_('This relative threshold can only be used if a maximum number is defined on ' + 'the firewall side and then read from fwConnTableLimit. By default, this ' + 'limit is not set in Check Point devices and this check than falls back to ' + 'the absolute defaults or the ones defined above'), + elements=[ + Percentage( + title=_('Warning at'), unit='%', minvalue=0.0, maxvalue=100.0, default_value=80.0), + Percentage( + title=_('Critical at'), unit='%', minvalue=0.0, maxvalue=100.0, default_value=90.0), + ])), + ('levels_lower_relative', + Tuple( + title=_('Percentage of minimum connections (only used if a limit is defined on ' + 'the Check Point device)'), + help=_('This relative threshold can only be used if a maximum number is defined on ' + 'the firewall side and then read from fwConnTableLimit. By default, this ' + 'limit is not set in Check Point devices and this check than falls back to ' + 'the absolute defaults or the ones defined above'), + elements=[ + Percentage( + title=_('Warning below'), unit='%', minvalue=0.0, maxvalue=100.0), + Percentage( + title=_('Critical below'), unit='%', minvalue=0.0, maxvalue=100.0), + ])), + ], + # optional_keys=['levels_upper_relative'], + ) + + +rulespec_registry.register( + CheckParameterRulespecWithItem( + check_group_name='checkpoint_fw_connections', + group=RulespecGroupCheckParametersNetworking, + match_type='dict', + parameter_valuespec=_parameter_valuespec_checkpoint_fw_connections, + title=lambda: _('Check Point Firewall Connections'), + )) diff --git a/packages/checkpoint_fw_connections b/packages/checkpoint_fw_connections index 602f14517a4f6fec98646191a76cbb62bab3ab34..118f7fd032558dac8101b287adbdf2fd0d1c71d8 100644 --- a/packages/checkpoint_fw_connections +++ b/packages/checkpoint_fw_connections @@ -15,7 +15,8 @@ ' - Connections rate/s\n' ' - Current connections\n' ' - Peak Connections\n' - ' - Current connections relative to table limit (if available)\n' + ' - Current connections relative to table limit (if ' + 'available)\n' '\n' 'WATO\n' ' - Upper/Lower levels for current connections (absolute)\n' @@ -24,12 +25,11 @@ ' - Admin connection table limit\n', 'download_url': 'https://thl-cmk.hopto.org', 'files': {'agent_based': ['checkpoint_fw_connections.py'], - 'web': ['plugins/metrics/checkpoint_fw_connections.py', - 'plugins/wato/checkpoint_fw_connections.py']}, + 'gui': ['metrics/checkpoint_fw_connections.py', + 'wato/checkpoint_fw_connections.py']}, 'name': 'checkpoint_fw_connections', - 'num_files': 3, 'title': 'Check Point Connections', - 'version': '20210825.v.0.0.3a', - 'version.min_required': '2.0.0', - 'version.packaged': '2021.07.14', - 'version.usable_until': None} + 'version': '20230303.v.0.0.4', + 'version.min_required': '2.1.0', + 'version.packaged': '2.1.0p21', + 'version.usable_until': None} \ No newline at end of file