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

update project

parent 18477546
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 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
# 2021-03-18 : fixed missing update agent snmp 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_inv_checkpoint_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])
try:
updateagentversion = string_table[1][0][0]
except IndexError:
updateagentversion = ''
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_inv_checkpoint_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='inv_checkpoint_base',
parse_function=parse_inv_checkpoint_base,
host_label_function=host_label_inv_checkpoint_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='inv_checkpoint_base',
inventory_function=inventory_checkpoint_base,
)
No preview for this file type
......@@ -6,12 +6,12 @@
'- 2021-02-08: initial release\n'
'- 2021-02-22: code cleanup\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['checkpoint_inv_base.py'],
'web': ['plugins/views/checkpoint_base.py']},
'files': {'agent_based': ['inv_checkpoint_base.py'],
'web': ['plugins/views/inv_checkpoint_base.py']},
'name': 'inv_checkpoint_base',
'num_files': 2,
'title': 'Check Point appliance base inventory plugin',
'version': '20210222.v.0.1',
'version': '20210318.v.0.1a',
'version.min_required': '2.0.0b8',
'version.packaged': '2.0.0',
'version.usable_until': None}
\ No newline at end of file
#!/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'),
},
})
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