diff --git a/agent_based/cisco_fw_nat_translations.py b/agent_based/cisco_fw_nat_translations.py index d37bd9dc1ac82a65fa4c47d5066fe5789c563dff..cb6a0dc37ca11cae8d4832ef6176301b29efffd8 100644 --- a/agent_based/cisco_fw_nat_translations.py +++ b/agent_based/cisco_fw_nat_translations.py @@ -35,7 +35,6 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( check_levels_predictive, SNMPTree, startswith, - contains, any_of, ) @@ -114,4 +113,4 @@ register.check_plugin( check_function=check_cisco_fw_nat_translations, check_default_parameters={}, check_ruleset_name='cisco_fw_nat_translations' -) \ No newline at end of file +) diff --git a/cisco_fw_nat_translations-0.0.2-20230607.mkp b/cisco_fw_nat_translations-0.0.2-20230607.mkp new file mode 100644 index 0000000000000000000000000000000000000000..259c275e7644e08cb9a7d7206bd22d4ef49a4978 Binary files /dev/null and b/cisco_fw_nat_translations-0.0.2-20230607.mkp differ diff --git a/cisco_fw_nat_translations.mkp b/cisco_fw_nat_translations.mkp index 473171a172ca5ae5183ad183de0b487e682171df..259c275e7644e08cb9a7d7206bd22d4ef49a4978 100644 Binary files a/cisco_fw_nat_translations.mkp and b/cisco_fw_nat_translations.mkp differ diff --git a/gui/metrics/cisco_fw_nat_translations.py b/gui/metrics/cisco_fw_nat_translations.py new file mode 100644 index 0000000000000000000000000000000000000000..7e3d295d6aeab4e63aa92684274627c5be3661a0 --- /dev/null +++ b/gui/metrics/cisco_fw_nat_translations.py @@ -0,0 +1,69 @@ +#!/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 : 2023-03-09 +# +# Cisco Firewall NAT translations metrics plugin +# + +from cmk.gui.i18n import _ + +from cmk.gui.plugins.metrics.utils import ( + metric_info, + graph_info, + check_metrics, + perfometer_info, +) + +# for predictive monitoring +check_metrics["check_mk-cisco_fw_nat_translations"] = { + "predict_fw_nat_active": {"auto_graph": False}, +} +metric_info['predict_fw_nat_active'] = { + 'title': _('_Predicted NAT translations'), + 'unit': 'count', + 'color': '26/b', +} +# + +metric_info['fw_nat_active'] = { + 'title': _('Active'), + 'unit': 'count', + 'color': '26/a', +} + +metric_info['fw_nat_peak'] = { + 'title': _('Peak'), + 'unit': 'count', + 'color': '16/a', +} + +graph_info['cisco_fw_nat_translations'] = { + 'title': _('NAT translatins'), + 'metrics': [ + ('predict_fw_nat_active', 'line'), + ('fw_nat_peak', 'line'), + ('fw_nat_active', 'area'), + ], + 'scalars': [ + ('fw_nat_active:crit'), # , _('CRIT') + ('fw_nat_active:warn'), # , _('WARN') + ], + 'optional_metrics': [ + 'predict_fw_nat_active', + ], + +} + +perfometer_info.append( + { + 'type': 'logarithmic', + 'metric': 'fw_nat_active', + 'half_value': 100000.0, + 'exponent': 2, + } +) diff --git a/gui/wato/cisco_fw_nat_translations.py b/gui/wato/cisco_fw_nat_translations.py new file mode 100644 index 0000000000000000000000000000000000000000..f5ed61cd40cf89c64eb6cf4fe399a27c2167f3f9 --- /dev/null +++ b/gui/wato/cisco_fw_nat_translations.py @@ -0,0 +1,58 @@ +#!/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 : 2023-03-09 +# +# Cisco Firewall NAT translations WATO plugin +# +# 2023-03-10: moved rule to Networking +# +# + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Integer, + Tuple, +) + +from cmk.gui.plugins.wato.utils import ( + CheckParameterRulespecWithoutItem, + rulespec_registry, + RulespecGroupCheckParametersNetworking, + Levels, +) + + +def _parameter_valuespec_cisco_fw_nat_translations(): + return Dictionary(elements=[ + ('levels_upper', + Levels( + title=_('NAT translations'), + unit=_('Translations'), + )), + ('levels_lower', + Tuple( + help=_('This rule sets lower levels to the active number of NAT translations through the firewall. ' + 'Will only be used if NAT translations is not predictive levels.'), + title=_('NAT translations lower levels'), + elements=[ + Integer(title=_('Warning if below'), unit='Translations'), + Integer(title=_('Critical if below'), unit='Translations'), + ], + )), + ],) + + +rulespec_registry.register( + CheckParameterRulespecWithoutItem( + check_group_name='cisco_fw_nat_translations', + group=RulespecGroupCheckParametersNetworking, + match_type='dict', + parameter_valuespec=_parameter_valuespec_cisco_fw_nat_translations, + title=lambda: _('Firewall NAT translatins'), + )) diff --git a/packages/cisco_fw_nat_translations b/packages/cisco_fw_nat_translations index e542bbd9eec321f2637c88e1ace6cee2e70a002f..8428fb2204a76f3d11f0d4a2d7c68c08c317c3a0 100644 --- a/packages/cisco_fw_nat_translations +++ b/packages/cisco_fw_nat_translations @@ -2,11 +2,11 @@ 'description': 'Monitor Cisco Firewall NAT translations\n', 'download_url': 'https://thl-cmk.hopto.org', 'files': {'agent_based': ['cisco_fw_nat_translations.py'], - 'web': ['plugins/metrics/cisco_fw_nat_translations.py', - 'plugins/wato/cisco_fw_nat_translations.py']}, + 'gui': ['metrics/cisco_fw_nat_translations.py', + 'wato/cisco_fw_nat_translations.py']}, 'name': 'cisco_fw_nat_translations', 'title': 'Cisco Firewall NAT Translations', - 'version': '20230310.v0.0.1a', - 'version.min_required': '2.0.0', - 'version.packaged': '2.1.0p22', + 'version': '0.0.2-20230607', + 'version.min_required': '2.1.0b1', + 'version.packaged': '2.1.0p21', 'version.usable_until': None} \ No newline at end of file