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

update project

parent 9b6d3c9b
No related branches found
No related tags found
No related merge requests found
2016-06-29 : inventory Check Point Appliance
2018-03-05 : added Patches, Deployment Agent Build
2018-03-07 : added Licenses
2020-06-01 : cleanup, prepared for cmk1.7x, rename from inv_checkpoint_svn to checkpoint_inv_base
2020-11-27 : rewrite for CMK check API 1.0 (CMK 2.0)
2020-11-28 : added available updates
2021-02-08 : transfered license/support info to seperate plugin
2021-02-22 : code cleanup
\ No newline at end of file
2016-06-29: inventory Check Point Appliance
2018-03-05: added Patches, Deployment Agent Build
2018-03-07: added Licenses
2020-06-01: cleanup, prepared for cmk1.7x, rename from inv_checkpoint_svn to checkpoint_inv_base
2020-11-27: rewrite for CMK check API 1.0 (CMK 2.0)
2020-11-28: added available updates
2021-02-08: transfered license/support info to seperate plugin
2021-02-22: code cleanup
2023-04-23: refactoring, moved views file to ~/local/lib/check_mk/gui/plugins/views
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Author: thl-cmk[at]outlook[dot]com / thl-cmk.hopto.org
# License: GNU General Public License v2
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2016-06-29
#
# Check Point inventory
#
# 2016-06-29 : inventory Check Point Appliance
# 2018-03-05 : added Patches, Deployment Agent Build
# 2018-03-07 : added Licenses
# 2020-06-01 : cleanup, prepared for cmk1.7x, rename from inv_checkpoint_svn to checkpoint_inv_base
# 2020-11-27 : rewrite for CMK check API 1.0 (CMK 2.0)
# 2020-11-28 : added available updates
# 2021-02-08 : transfered license/support info to seperate plugin
# 2021-02-22 : code cleanup
#
# sample string_table
# [
# [
# ['0008262230', 'Smart-1 5150 NGSM', 'E4:43:4B:AA:BB:CC', 'a5rYfxLngVSZtHjK2sfghhp6noVfzuTvSEbt', 'CPAP-NGSM5150', 'Collaborative Enterprise Support - StandardPro Add-on for Products', '1751500800', '2']
# ]
# ]
#
# 2016-06-29: inventory Check Point Appliance
# 2018-03-05: added Patches, Deployment Agent Build
# 2018-03-07: added Licenses
# 2020-06-01: cleanup, prepared for cmk1.7x, rename from inv_checkpoint_svn to checkpoint_inv_base
# 2020-11-27: rewrite for CMK check API 1.0 (CMK 2.0)
# 2020-11-28: added available updates
# 2021-02-08: transfered cp_license/support info to seperate plugin
# 2021-02-22: code cleanup
# 2023-04-23: refactoring
import time
import time
from typing import List, NamedTuple
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable,
InventoryResult,
......@@ -42,22 +38,44 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
class CheckpointLicensing(NamedTuple):
accountid: str
packagedescription: str
containerck: str
signaturekey: str
containersku: str
supportlevel: str
supportexpiration: str
activationstatus: str
account_id: str
package_description: str
container_ck: str
signature_key: str
container_sku: str
support_level: str
support_expiration: str
activation_status: str
def parse_inv_checkpoint_support(string_table: StringTable) -> List:
# pprint will not format named tuples nicely :-(
"""
>>> from pprint import pp
>>> string_table = ['0008262230', 'Smart-1 5150 NGSM', 'E4:43:4B:AA:BB:CC', 'a5rYfxLngVSZtHjK2sfghhp6noVfzuTvSEbt']
>>> string_table += ['CPAP-NGSM5150', 'Collaborative Enterprise Support - StandardPro Add-on for Products']
>>> string_table += ['1751500800', '2']
>>> string_table = [string_table]
>>> pp(string_table)
[['0008262230',
'Smart-1 5150 NGSM',
'E4:43:4B:AA:BB:CC',
'a5rYfxLngVSZtHjK2sfghhp6noVfzuTvSEbt',
'CPAP-NGSM5150',
'Collaborative Enterprise Support - StandardPro Add-on for Products',
'1751500800',
'2']]
>>> pp(parse_inv_checkpoint_support(string_table))
[CheckpointLicensing(account_id='0008262230', package_description='Smart-1 5150 NGSM', container_ck='E4:43:4B:AA:BB:CC', signature_key='a5rYfxLngVSZtHjK2sfghhp6noVfzuTvSEbt', container_sku='CPAP-NGSM5150', support_level='Collaborative Enterprise Support - StandardPro Add-on for Products', support_expiration='1751500800', activation_status='2')]
"""
section = []
for license in string_table:
license = CheckpointLicensing(*license)
if not license.containerck == '':
section.append(license)
for cp_license in string_table:
try:
cp_license = CheckpointLicensing(*cp_license)
except TypeError:
continue
if not cp_license.container_ck == '':
section.append(cp_license)
return section
......@@ -69,23 +87,23 @@ def inventory_checkpoint_support(section: List) -> InventoryResult:
'2': 'activated'
}
for license in section:
license = CheckpointLicensing(*license)
supportexpiration = 'N/A'
if not license.supportexpiration == '':
supportexpiration = time.strftime("%Y-%m-%d %H:%M", time.localtime(int(license.supportexpiration)))
for cp_license in section:
cp_license = CheckpointLicensing(*cp_license)
support_expiration = 'N/A'
if not cp_license.support_expiration == '':
support_expiration = time.strftime("%Y-%m-%d %H:%M", time.localtime(int(cp_license.support_expiration)))
yield TableRow(
path=path,
key_columns={'certificate_key': license.containerck},
key_columns={'certificate_key': cp_license.container_ck},
inventory_columns={
'account_id': license.accountid,
'description': license.packagedescription,
'signatur_key': license.signaturekey,
'container': license.containersku,
'support_type': license.supportlevel,
'support_renewal': supportexpiration,
'state': lic_state.get(license.activationstatus, license.activationstatus)
'account_id': cp_license.account_id,
'description': cp_license.package_description,
'signatur_key': cp_license.signature_key,
'container': cp_license.container_sku,
'support_type': cp_license.support_level,
'support_renewal': support_expiration,
'state': lic_state.get(cp_license.activation_status, cp_license.activation_status)
},
)
......
#!/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 : 2016-06-29
# 2023-04-23: moved views file to ~/local/lib/check_mk/gui/plugins/views
from cmk.gui.i18n import _
from cmk.gui.plugins.views.inventory import declare_invtable_view
from cmk.gui.plugins.views.utils import (
inventory_displayhints,
)
inventory_displayhints.update({
'.software.check_point.support:': {
'title': _('Support'),
'keyorder': [
'account_id',
'certificate_key',
'container',
'description',
'state',
'support_renewal',
'support_type',
],
'view': 'invcheckpointsupport_of_host',
},
})
declare_invtable_view(
'invcheckpointsupport',
'.software.check_point.support:',
_('Check Point support'),
_('Check Point support'),
)
No preview for this file type
......@@ -3,11 +3,10 @@
'status\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['inv_checkpoint_support.py'],
'web': ['plugins/views/inv_checkpoint_support.py']},
'gui': ['views/inv_checkpoint_support.py']},
'name': 'inv_checkpoint_support',
'num_files': 2,
'title': 'Check Point appliance support inventory plugin',
'version': '20210208.v.0.1',
'version.min_required': '2.0.0',
'version.packaged': '2021.09.20',
'version': '0.2.1-20230422',
'version.min_required': '2.1.0b1',
'version.packaged': '2.1.0p21',
'version.usable_until': None}
\ 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