diff --git a/agent_based/checkpoint_threat_emulation.py b/agent_based/checkpoint_threat_emulation.py index d17fff297f9f0b2074df268fd7db63c6de198b32..165816ba6f372be4204494a496ddba54dc7118f9 100644 --- a/agent_based/checkpoint_threat_emulation.py +++ b/agent_based/checkpoint_threat_emulation.py @@ -17,6 +17,7 @@ # 2021-08-27: rewritten for CMK 2.0 # 2022-09-08: fixed check_default_parameters # fixed levels for remaining quota in cloud, use lower instead of upper +# 2023-05-29: moved guis files to ~/local/lib/check_mk/gui/plugins/... # # snmpwalk sample @@ -25,11 +26,11 @@ # # [ # [ -# [u'0%', u'0', u'up-to-date', u'Gateway is up to date.', u'1548979200', u'100000', u'100000', u'valid', u'ok', -# u'Quota subscription is valid', u'990002053', u'0', u'ok', u''] +# ['0%', '0', 'up-to-date', 'Gateway is up to date.', '1548979200', '100000', '100000', 'valid', 'ok', +# 'Quota subscription is valid', '990002053', '0', 'ok', ''] # ], # [ -# [u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0'] +# ['0', '0', '0', '0', '0', '0', '0', '0'] # ] # ] # @@ -269,13 +270,13 @@ register.check_plugin( # # # # sample te_analysis # # -# # [[u'1', u'Image', u'1afbde2e-d593-45a8-a686-6cbd42f37823', u'', u'0', u'0', u'0', u'0', u'0', u'0', u'0'], -# # [u'2', u'Image', u'1b0c5014-714d-47f3-9b10-0b7ee386e745', u'', u'0', u'0', u'0', u'0', u'0', u'0', u'0'], -# # [u'3', u'Image', u'5e5de275-a103-4f67-b55b-47532918fa59', u'Win7,Office 2013,Adobe 11', u'0', u'0', u'0', u'0', u'0', u'0', u'0'], -# # [u'4', u'Image', u'e50e99f3-5963-4573-af9e-e3f4750b55e2', u'WinXP,Office 2003/7,Adobe 9', u'0', u'0', u'0', u'0', u'0', u'0', u'0'], -# # [u'5', u'Detection Rules', u'5e5de275-a103-4f67-b55b-47532918fa59', u'Win7,Office 2013,Adobe 11', u'56431', u'46960', u'Thu Mar 15 08:39:31 2018', u'0', u'0', u'0', u'0'], -# # [u'6', u'Detection Rules', u'e50e99f3-5963-4573-af9e-e3f4750b55e2', u'WinXP,Office 2003/7,Adobe 9', u'56431', u'52602', u'Thu Mar 15 08:39:26 2018', u'0', u'0', u'0', u'0'], -# # [u'7', u'Static Analysis Rules', u'496149D5-0689-472B-8F50-21DD409F0EC6', u'Static Analysis Detection Rules', u'53030', u'25049', u'Thu Mar 15 08:39:24 2018', u'0', u'0', u'0', u'0']] +# # [['1', 'Image', '1afbde2e-d593-45a8-a686-6cbd42f37823', '', '0', '0', '0', '0', '0', '0', '0'], +# # ['2', 'Image', '1b0c5014-714d-47f3-9b10-0b7ee386e745', '', '0', '0', '0', '0', '0', '0', '0'], +# # ['3', 'Image', '5e5de275-a103-4f67-b55b-47532918fa59', 'Win7,Office 2013,Adobe 11', '0', '0', '0', '0', '0', '0', '0'], +# # ['4', 'Image', 'e50e99f3-5963-4573-af9e-e3f4750b55e2', 'WinXP,Office 2003/7,Adobe 9', '0', '0', '0', '0', '0', '0', '0'], +# # ['5', 'Detection Rules', '5e5de275-a103-4f67-b55b-47532918fa59', 'Win7,Office 2013,Adobe 11', '56431', '46960', 'Thu Mar 15 08:39:31 2018', '0', '0', '0', '0'], +# # ['6', 'Detection Rules', 'e50e99f3-5963-4573-af9e-e3f4750b55e2', 'WinXP,Office 2003/7,Adobe 9', '56431', '52602', 'Thu Mar 15 08:39:26 2018', '0', '0', '0', '0'], +# # ['7', 'Static Analysis Rules', '496149D5-0689-472B-8F50-21DD409F0EC6', 'Static Analysis Detection Rules', '53030', '25049', 'Thu Mar 15 08:39:24 2018', '0', '0', '0', '0']] # # # # eher fuer inventory (?) # # diff --git a/checkpoint_threat_emulation-0.2.0-20230529.mkp b/checkpoint_threat_emulation-0.2.0-20230529.mkp new file mode 100644 index 0000000000000000000000000000000000000000..3b8da48a1fa7ed59c7ae9dcafd7ff15ad9b1617b Binary files /dev/null and b/checkpoint_threat_emulation-0.2.0-20230529.mkp differ diff --git a/checkpoint_threat_emulation.mkp b/checkpoint_threat_emulation.mkp index 14504dfd7880a29ca5139855f5b8b4828b4ce668..3b8da48a1fa7ed59c7ae9dcafd7ff15ad9b1617b 100644 Binary files a/checkpoint_threat_emulation.mkp and b/checkpoint_threat_emulation.mkp differ diff --git a/gui/metrics/checkpoint_threat_emulation.py b/gui/metrics/checkpoint_threat_emulation.py new file mode 100644 index 0000000000000000000000000000000000000000..81d8fa8499608952b5f10efab4ebdc8b6646ee66 --- /dev/null +++ b/gui/metrics/checkpoint_threat_emulation.py @@ -0,0 +1,163 @@ +#!/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-19 +# +# Check Point Threat Emulation metrics plugin +# checkpoint_threat_emulation +# + +from cmk.gui.i18n import _ + +from cmk.gui.plugins.metrics.utils import ( + metric_info, + graph_info, + perfometer_info, +) + +metric_info['checkpoint_threat_emulation_remaining_quota_on_cloud'] = { + 'title': _('Remaining quota on cloud'), + 'unit': 'count', + 'color': '11/a', +} +metric_info['checkpoint_threat_emulation_monthly_quota_on_cloud_used'] = { + 'title': _('Used monthly quota on cloud'), + 'unit': '%', + 'color': '12/a', +} +metric_info['checkpoint_threat_emulation_current_files_waiting_for_emulation'] = { + 'title': _('Files waiting for emulation'), + 'unit': 'count', + 'color': '13/a', +} + +metric_info['checkpoint_threat_emulation_scanned_files_current'] = { + 'title': _('Scanned files (current)'), + 'unit': 'count', + 'color': '14/a', +} + +metric_info['checkpoint_threat_emulation_malicious_files_detected_current'] = { + 'title': _('Malicious files detected (current)'), + 'unit': 'count', + 'color': '15/a', +} + +metric_info['checkpoint_threat_emulation_files_scanned_by_threat_cloud_current'] = { + 'title': _('Files scanned by threat cloud (current)'), + 'unit': 'count', + 'color': '16/a', +} + +metric_info['checkpoint_threat_emulation_malicious_files_detected_by_threat_cloud_current'] = { + 'title': _('Malicious files detected by threat cloud (current)'), + 'unit': 'count', + 'color': '21/a', +} + +metric_info['checkpoint_threat_emulation_average_process_time_current'] = { + 'title': _('Average process time (current)'), + 'unit': 's', + 'color': '22/a', +} + +metric_info['checkpoint_threat_emulation_average_emulated_file_size_current'] = { + 'title': _('Average emulated file size (current)'), + 'unit': 'bytes', + 'color': '23/a', +} + +metric_info['checkpoint_threat_emulation_average_queue_size_current'] = { + 'title': _('Average queue size (current)'), + 'unit': 'count', + 'color': '24/a', +} + +metric_info['checkpoint_threat_emulation_peak_queue_size_current'] = { + 'title': _('Peak queue size (current)'), + 'unit': 'count', + 'color': '25/a', +} + +graph_info['checkpoint_threat_emulation_remaining_quota_on_cloud'] = { + 'title': _('Check Point Threat Emulation remaining quota on cloud'), + 'metrics': [ + ('checkpoint_threat_emulation_remaining_quota_on_cloud', 'line'), + ], + 'scalars': [ + ('checkpoint_threat_emulation_remaining_quota_on_cloud:crit'), + ('checkpoint_threat_emulation_remaining_quota_on_cloud:warn'), + ], +} +graph_info['checkpoint_threat_emulation_monthly_quota_on_cloud_used'] = { + 'title': _('Check Point Threat Emulation monthly used quota on cloud used'), + 'metrics': [ + ('checkpoint_threat_emulation_monthly_quota_on_cloud_used', 'line'), + ], + 'scalars': [ + ('checkpoint_threat_emulation_monthly_quota_on_cloud_used:crit'), + ('checkpoint_threat_emulation_monthly_quota_on_cloud_used:warn'), + ], +} +graph_info['checkpoint_threat_emulation_current_files_waiting_for_emulation'] = { + 'title': _('Check Point Threat Emulation files waiting for emulation'), + 'metrics': [ + ('checkpoint_threat_emulation_current_files_waiting_for_emulation', 'line'), + ], + 'scalars': [ + ('checkpoint_threat_emulation_current_files_waiting_for_emulation:crit'), + ('checkpoint_threat_emulation_current_files_waiting_for_emulation:warn'), + ], +} +graph_info['checkpoint_threat_emulation_scanned_files_current'] = { + 'title': _('Check Point Threat Emulation scanned files'), + 'metrics': [ + ('checkpoint_threat_emulation_scanned_files_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_malicious_files_detected_current'] = { + 'title': _('Check Point Threat Emulation malicious files detected'), + 'metrics': [ + ('checkpoint_threat_emulation_malicious_files_detected_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_files_scanned_by_threat_cloud_current'] = { + 'title': _('Check Point Threat Emulation files scanned by Threat Cloud'), + 'metrics': [ + ('checkpoint_threat_emulation_files_scanned_by_threat_cloud_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_malicious_files_detected_by_threat_cloud_current'] = { + 'title': _('Check Point Threat Emulation malicious files detected by Threat Cloud'), + 'metrics': [ + ('checkpoint_threat_emulation_malicious_files_detected_by_threat_cloud_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_average_process_time_current'] = { + 'title': _('Check Point Threat Emulation average process time'), + 'metrics': [ + ('checkpoint_threat_emulation_average_process_time_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_average_emulated_file_size_current'] = { + 'title': _('Check Point Threat Emulation average emulated file size'), + 'metrics': [ + ('checkpoint_threat_emulation_average_emulated_file_size_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_average_queue_size_current'] = { + 'title': _('Check Point Threat Emulation average queue size'), + 'metrics': [ + ('checkpoint_threat_emulation_average_queue_size_current', 'line'), + ], +} +graph_info['checkpoint_threat_emulation_peak_queue_size_current'] = { + 'title': _('Check Point Threat Emulation peak queue size'), + 'metrics': [ + ('checkpoint_threat_emulation_peak_queue_size_current', 'line'), + ], +} diff --git a/gui/wato/checkpoint_threat_emulation.py b/gui/wato/checkpoint_threat_emulation.py new file mode 100644 index 0000000000000000000000000000000000000000..9d5a3d7da2b9537f51480d7394182451fda02899 --- /dev/null +++ b/gui/wato/checkpoint_threat_emulation.py @@ -0,0 +1,60 @@ +#!/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 +# +# 2022-11-30: fixed CheckParameterRulespecWithoutItem (from CheckParameterRulespecWithItem)' + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Tuple, + Integer, +) + +from cmk.gui.plugins.wato.utils import ( + CheckParameterRulespecWithoutItem, + rulespec_registry, + RulespecGroupCheckParametersNetworking, +) + + +def _parameter_valuespec_checkpoint_threat_emulation(): + return Dictionary( + elements=[ + ('used_monthly_quota_levels', + Tuple( + title=_('Levels for used monthly quota on cloud'), + elements=[ + Integer(title=_('Warning at'), default_value=90, unit=_('%')), + Integer(title=_('Critical at'), default_value=95, unit=_('%')), + ])), + ('remaining_quota_levels', + Tuple( + title=_('Levels for remaining quota on cloud'), + elements=[ + Integer(title=_('Warning at'), default_value=10000, unit=_('Files')), + Integer(title=_('Critical at'), default_value=5000, unit=_('Files')), + ])), + ('files_waiting_levels', + Tuple( + title=_('Levels for files waiting for emulation'), + elements=[ + Integer(title=_('Warning at'), default_value=5, unit=_('Files')), + Integer(title=_('Critical at'), default_value=10, unit=_('Files')), + ])), + ], + ) + + +rulespec_registry.register( + CheckParameterRulespecWithoutItem( + check_group_name='checkpoint_threat_emulation', + group=RulespecGroupCheckParametersNetworking, + match_type='dict', + parameter_valuespec=_parameter_valuespec_checkpoint_threat_emulation, + title=lambda: _('Check Point Threat Emulation status'), + )) diff --git a/packages/checkpoint_threat_emulation b/packages/checkpoint_threat_emulation index fd231cb5cc3e7d6abbe7475fcf7c0fcd0578bb3c..52eb521a4e29167805dfe0a94db3cf65e3274b55 100644 --- a/packages/checkpoint_threat_emulation +++ b/packages/checkpoint_threat_emulation @@ -10,12 +10,11 @@ 'subscription\n', 'download_url': 'https://thl-cmk.hopto.org', 'files': {'agent_based': ['checkpoint_threat_emulation.py'], - 'web': ['plugins/metrics/checkpoint_threat_emulation.py', - 'plugins/wato/checkpoint_threat_emulation.py']}, + 'gui': ['metrics/checkpoint_threat_emulation.py', + 'wato/checkpoint_threat_emulation.py']}, 'name': 'checkpoint_threat_emulation', - 'num_files': 3, 'title': 'Check Point Threat Emulation', - 'version': '20221130.v.0.0.3c', - 'version.min_required': '2.0.0', - 'version.packaged': '2021.09.20', + 'version': '0.2.0-20230529', + 'version.min_required': '2.1.0b1', + 'version.packaged': '2.1.0p21', 'version.usable_until': None} \ No newline at end of file