diff --git a/agent_based/checkpoint_inv_base.py b/agent_based/checkpoint_inv_base.py deleted file mode 100644 index db97bed68d0824899c4e33254a7a09ad5b699340..0000000000000000000000000000000000000000 --- a/agent_based/checkpoint_inv_base.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Author: thl-cmk[at]outlook[dot]com / thl-cmk.hopto.org -# -# Check Point base 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 -# 2021-03-05 : added hostlabel section -# -# sample string_table -# [ -# [ -# ['5M7C043', 'Smart-1 5150', 'CheckPoint', 'Smart-1', 'R80.40', '994000022', 'Gaia', '3', '10'] -# ], -# [ -# ['1959'] -# ], -# ] -# - -from typing import List, NamedTuple - -from .agent_based_api.v1.type_defs import ( - HostLabelGenerator, - StringTable, - InventoryResult, -) -from .agent_based_api.v1 import ( - Attributes, - HostLabel, - register, - SNMPTree, - startswith, - all_of, - any_of, - equals, -) - - -def parse_checkpoint_inv_base(string_table: List[StringTable]) -> List: - class CheckpointInvBaseInfo(NamedTuple): - serialnumber: str - productname: str - manufacturer: str - series: str - version: str - build: str - osname: str - osmajorver: str - osminorver: str - - section = [] - baseinfo = CheckpointInvBaseInfo(*string_table[0][0]) - updateagentversion = string_table[1][0][0] - - invPath = ['hardware', 'system'] - - if not baseinfo.serialnumber == '': - section.append((invPath, 'serial', baseinfo.serialnumber)) - if not baseinfo.series == '': - section.append((invPath, 'appliance_series', baseinfo.series)) - if not baseinfo.manufacturer == '': - section.append((invPath, 'manufacturer', baseinfo.manufacturer)) - if not baseinfo.productname == '': - section.append((invPath, 'product_name', baseinfo.productname)) - - invPath = ['software', 'check_point', 'os_info'] - - if not baseinfo.version == '': - section.append((invPath, 'svn_version', baseinfo.version)) - if not baseinfo.build == '': - section.append((invPath, 'svn_build', baseinfo.build)) - if not baseinfo.osname == '': - section.append((invPath, 'os_name', baseinfo.osname)) - if not baseinfo.osmajorver == '' and not baseinfo.osminorver == '': - section.append((invPath, 'os_version', baseinfo.osmajorver + '.' + baseinfo.osminorver)) - if not updateagentversion == '': - section.append((invPath, 'deployment_agent_build', updateagentversion)) - - return section - - -def host_label_checkpoint_inv_base(section: List) -> HostLabelGenerator: - for invPath, key, value in section: - if key == 'appliance_series' and value.lower() == 'maestro': - yield HostLabel('checkpoint/device_type', 'maestro') - - -def inventory_checkpoint_base(section: List) -> InventoryResult: - for invPath, key, value in section: - yield Attributes( - path=invPath, - inventory_attributes={key: value}) - - -register.snmp_section( - name='checkpoint_inv_base', - parse_function=parse_checkpoint_inv_base, - host_label_function=host_label_checkpoint_inv_base, - fetch=[ - SNMPTree( - base='.1.3.6.1.4.1.2620.1.6', # CHECKPOINT-MIB::svn - oids=[ - '16.3', # svnApplianceSerialNumber - '16.7', # svnApplianceProductName - '16.9', # svnApplianceManufacturer - '16.10', # svnApplianceSeries - '4.1', # svnVersion - '4.2', # svnBuild - '5.1', # osName - '5.2', # osMajorVer - '5.3', # osMinorVer - ] - ), - SNMPTree( - base='.1.3.6.1.4.1.2620.1.6.20', # CHECKPOINT-MIB::svnUpdatesInfo - oids=[ - '1', # svnUpdatesInfoBuild - ] - ), - ], - detect=any_of( - startswith('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.2620'), # sysObjectID == CheckPoint - all_of( - equals('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.8072.3.2.10'), # sysObjectID == Linux - equals('.1.3.6.1.4.1.2620.1.6.1.0', 'SVN Foundation'), # CheckPoint software installed - ) - ) -) - -register.inventory_plugin( - name='checkpoint_inv_base', - inventory_function=inventory_checkpoint_base, -) diff --git a/inv_checkpoint_base.mkp b/inv_checkpoint_base.mkp index 8efaf690fca5aff8f5958ff7eb5d365c82c6b8f9..25c2a98c2cac6e136fdc883909577201f19d1cc9 100644 Binary files a/inv_checkpoint_base.mkp and b/inv_checkpoint_base.mkp differ diff --git a/web/plugins/views/checkpoint_base.py b/web/plugins/views/checkpoint_base.py deleted file mode 100644 index 5aacd0bf2c4b2807569cbc27cc5b2bec2d713d5a..0000000000000000000000000000000000000000 --- a/web/plugins/views/checkpoint_base.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import cmk.gui.utils -from cmk.gui.plugins.views import ( - inventory_displayhints,) -from cmk.gui.i18n import _ - -inventory_displayhints.update({ - '.software.check_point.os_info:': { - 'title': _('OS info'), - - }, - })