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

update project

parent caf7f708
No related branches found
No related tags found
No related merge requests found
#!/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 = list(string_table[0])
section.updatesavailable = list(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='inv_checkpoint_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='inv_checkpoint_updates',
inventory_function=inventory_checkpoint_updates,
)
No preview for this file type
......@@ -4,8 +4,8 @@
'\n'
'- 2021-02-08: initial release\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['checkpoint_inv_updates.py'],
'web': ['plugins/views/checkpoint_updates.py']},
'files': {'agent_based': ['inv_checkpoint_updates.py'],
'web': ['plugins/views/inv_checkpoint_updates.py']},
'name': 'inv_checkpoint_updates',
'num_files': 2,
'title': 'Check Point appliance avilable updates inventory plugin',
......
#!/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'),
)
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