diff --git a/agent_based/checkpoint_inv_updates.py b/agent_based/checkpoint_inv_updates.py deleted file mode 100644 index 631aa183ac84c664f4d138aa502e3822dd1a9db4..0000000000000000000000000000000000000000 --- a/agent_based/checkpoint_inv_updates.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Author: thl-cmk[at]outlook[dot]com / thl-cmk.hopto.org -# -# Check Point updates 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 -# -# sample string_table -# [ -# [ -# ['Check_Point_SmartConsole_R80_40_jumbo_HF_B411_Win.tgz', 'HFA', 'Installed'], -# ['Check_Point_R80_40_JUMBO_HF_Bundle_T78_sk165456_FULL.tgz', 'Wrapper', 'Installed'], -# ['Check_Point_CPinfo_Bundle_R80_40_T53.tgz', 'HFA', 'Installed'] -# ], -# [ -# ['Check_Point_SmartConsole_R80_40_jumbo_HF_B411_Win.tgz', 'R80.40 SmartConsole Build 411', 'capability', 'Installed', '2020-09-30T00:00:00Z', 'Recommended', '2020-10-12T15:19:51Z'], -# ['Check_Point_R80_40_JUMBO_HF_Bundle_T78_sk165456_FULL.tgz', 'R80.40 Jumbo Hotfix Accumulator General Availability (Take 78)', 'jumbo', 'Installed', '2020-08-24T00:00:00Z', 'Recommended', '2020-10-12T15:36:58Z'], -# ['Check_Point_CPinfo_Bundle_R80_40_T53.tgz', 'Check Point CPinfo build 202 for R80.40', 'capability', 'Installed', '2020-01-26T00:00:00Z', 'Recommended', '2020-10-12T15:19:16Z'], -# ['Check_Point_SmartConsole_R80_40_jumbo_HF_B410_Win.tgz', 'Check Point SmartConsole R80.40 Jumbo Hotfix B410', 'capability', 'Available for Install', '2020-08-24T00:00:00Z', 'Not Recommended', '2020-09-08T16:33:07Z'], -# ['Check_Point_R80_40_JUMBO_HF_Bundle_T77_sk165456_FULL.tgz', 'Check_Point_R80_40_JUMBO_HF_Bundle_T77_sk165456_FULL.tgz', 'jumbo', 'Installed as part of', '1970-01-01T00:00:00Z', 'Not Recommended', '2020-09-07T19:06:50Z'], -# ['Check_Point_R81_T392_Fresh_Install_and_Upgrade.tgz', 'R81 Gaia Fresh Install and upgrade', 'major', 'Available for Download', '2020-10-22T00:00:00Z', 'Not Recommended', '1970-01-01T00:00:00Z'], -# ['Blink_image_1.1_Check_Point_R81_T392_SecurityManagement.tgz', '<b>[Latest] R81 Security Management for appliances </b>', 'major', 'Available for Download', '2020-10-22T00:00:00Z', 'Not Recommended', '1970-01-01T00:00:00Z'], -# ['Blink_image_1.1_Check_Point_R80.40_T294_JHF_T78_SecurityManagement.tgz', '<b>[Latest] R80.40 Security Management + JHF T78 for Appliances and Open Servers</b>', 'major', 'Available for Download', '2020-08-24T00:00:00Z', 'Not Recommended', '1970-01-01T00:00:00Z'], -# ['Check_Point_R80.40_T294_Fresh_Install_and_Upgrade.tgz', 'Check Point R80.40 Gaia Fresh Install and upgrade', 'major', 'Available for Download', '2020-01-27T00:00:00Z', 'Not Recommended', '1970-01-01T00:00:00Z'] -# ], -# ] -# - -from typing import List, NamedTuple - -from .agent_based_api.v1.type_defs import ( - StringTable, - InventoryResult, -) -from .agent_based_api.v1 import ( - register, - SNMPTree, - TableRow, - startswith, - all_of, - any_of, - equals, -) - - -class CheckpointUpdatesRecommended(NamedTuple): - name: str - type: str - status: list - - -class CheckpointUpdatesAvailable(NamedTuple): - filename: str - description: str - type: str - status: str - availablesince: str - recommended: str - installedat: str - - -class CheckpointUpdates(NamedTuple): - updatesrecommended: list - updatesavailable: list - - -def parse_checkpoint_updates(string_table: List[StringTable]) -> CheckpointUpdates: - section = CheckpointUpdates - section.updatesrecommended = string_table[0] - section.updatesavailable = string_table[1] - return section - - -def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult: - path = ['software', 'check_point', 'updates'] - - for update in section.updatesrecommended: - update = CheckpointUpdatesRecommended(*update) - yield TableRow( - path=path, - key_columns={'file_name': update.name}, - inventory_columns={ - 'type': update.type, - 'status': update.status, - 'recommended': 'Recommended', - }, - ) - - for update in section.updatesavailable: - update = CheckpointUpdatesAvailable(*update) - - if not 'installed' in update.status.lower(): - installedat = 'N/A' - else: - installedat = update.installedat.replace('T', ' ').replace('Z', '') - - yield TableRow( - path=path, - key_columns={'file_name': update.filename}, - inventory_columns={ - 'description': update.description, - 'type': update.type, - 'status': update.status, - 'recommended': update.recommended, - 'available_since': update.availablesince[:10], - 'installed_at': installedat, - }, - ) - - -register.snmp_section( - name='checkpoint_inv_updates', - parse_function=parse_checkpoint_updates, - fetch=[ - SNMPTree( - base='.1.3.6.1.4.1.2620.1.6.20.8.1', # CHECKPOINT-MIB::updatesRecommendedEntry - oids=[ - '2', # updatesRecommendedName - '3', # updatesRecommendedType - '4', # updatesRecommendedStatus - ] - ), - SNMPTree( - base='.1.3.6.1.4.1.2620.1.6.20.10.1', # CHECKPOINT-MIB::availableUpdates - oids=[ - '2', # filename - '3', # description - '4', # type - '5', # status - '6', # available_since - '7', # recommended - '8', # installed_at - ] - ), - ], - detect=any_of( - startswith('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.2620'), - all_of( - equals('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.8072.3.2.10'), - equals('.1.3.6.1.4.1.2620.1.6.1.0', 'SVN Foundation'), - ) - ) -) - -register.inventory_plugin( - name='checkpoint_inv_updates', - inventory_function=inventory_checkpoint_updates, -) diff --git a/inv_checkpoint_updates.mkp b/inv_checkpoint_updates.mkp index 035192c073cc5bbf097a247db2fc43b60c17faa3..ac8b39ac43fa359887a463409326ed94445b7157 100644 Binary files a/inv_checkpoint_updates.mkp and b/inv_checkpoint_updates.mkp differ diff --git a/web/plugins/views/checkpoint_updates.py b/web/plugins/views/checkpoint_updates.py deleted file mode 100644 index 8e5eb6fb893a985c871b0f0c898497c50fda498f..0000000000000000000000000000000000000000 --- a/web/plugins/views/checkpoint_updates.py +++ /dev/null @@ -1,32 +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.updates:': { - 'title': _('Updates'), - 'keyorder': [ - 'file_name', - 'type', - 'status', - 'recommended', - 'available_since', - 'installed_at', - 'description' - ], - 'view': 'invcheckpointupdates_of_host', - }, - }) - -from cmk.gui.plugins.views.inventory import declare_invtable_view - -declare_invtable_view( - 'invcheckpointupdates', - '.software.check_point.updates:', - _('Check Point updates'), - _('Check Point updates'), -)