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

update project

parent 484183c4
Branches master
No related tags found
No related merge requests found
...@@ -5,4 +5,5 @@ ...@@ -5,4 +5,5 @@
2020-11-27: rewrite for CMK check API 1.0 (CMK 2.0) 2020-11-27: rewrite for CMK check API 1.0 (CMK 2.0)
2020-11-28: added available updates 2020-11-28: added available updates
2021-02-08: transfered license/support info to seperate plugin 2021-02-08: transfered license/support info to seperate plugin
2021-02-22: code cleanup 2021-02-22: code cleanup
\ No newline at end of file 2023-04-23: refactoring, moved views file to ~/local/lib/check_mk/gui/plugins/views
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- 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 updates inventory # Check Point updates inventory
# #
# 2016-06-29 : inventory Check Point Appliance # 2016-06-29: inventory Check Point Appliance
# 2018-03-05 : added Patches, Deployment Agent Build # 2018-03-05: added Patches, Deployment Agent Build
# 2018-03-07 : added Licenses # 2018-03-07: added Licenses
# 2020-06-01 : cleanup, prepared for cmk1.7x, rename from inv_checkpoint_svn to checkpoint_inv_base # 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-27: rewrite for CMK check API 1.0 (CMK 2.0)
# 2020-11-28 : added available updates # 2020-11-28: added available updates
# 2021-02-08 : transfered license/support info to seperate plugin # 2021-02-08: transferred license/support info to separate plugin
# 2021-02-22: code cleanup
# 2021-04-23: refactoring
# #
# sample string_table # sample string_table
# [ # [
...@@ -34,8 +40,7 @@ ...@@ -34,8 +40,7 @@
# ] # ]
# #
from typing import List, NamedTuple from typing import List, NamedTuple, Optional
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
StringTable, StringTable,
InventoryResult, InventoryResult,
...@@ -62,27 +67,31 @@ class CheckpointUpdatesAvailable(NamedTuple): ...@@ -62,27 +67,31 @@ class CheckpointUpdatesAvailable(NamedTuple):
description: str description: str
type: str type: str
status: str status: str
availablesince: str available_since: str
recommended: str recommended: str
installedat: str installed_at: str
class CheckpointUpdates(NamedTuple): class CheckpointUpdates(NamedTuple):
updatesrecommended: list updates_recommended: list
updatesavailable: list updates_available: list
def parse_checkpoint_updates(string_table: List[StringTable]) -> CheckpointUpdates: def parse_checkpoint_updates(string_table: List[StringTable]) -> Optional[CheckpointUpdates]:
section = CheckpointUpdates try:
section.updatesrecommended = list(string_table[0]) section = CheckpointUpdates(
section.updatesavailable = list(string_table[1]) updates_recommended=list(string_table[0]),
updates_available=list(string_table[1])
)
except IndexError:
return
return section return section
def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult: def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult:
path = ['software', 'check_point', 'updates'] path = ['software', 'check_point', 'updates']
for update in section.updatesrecommended: for update in section.updates_recommended:
update = CheckpointUpdatesRecommended(*update) update = CheckpointUpdatesRecommended(*update)
yield TableRow( yield TableRow(
path=path, path=path,
...@@ -94,13 +103,13 @@ def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult: ...@@ -94,13 +103,13 @@ def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult:
}, },
) )
for update in section.updatesavailable: for update in section.updates_available:
update = CheckpointUpdatesAvailable(*update) update = CheckpointUpdatesAvailable(*update)
if not 'installed' in update.status.lower(): if 'installed' not in update.status.lower():
installedat = 'N/A' installed_at = 'N/A'
else: else:
installedat = update.installedat.replace('T', ' ').replace('Z', '') installed_at = update.installed_at.replace('T', ' ').replace('Z', '')
yield TableRow( yield TableRow(
path=path, path=path,
...@@ -110,8 +119,8 @@ def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult: ...@@ -110,8 +119,8 @@ def inventory_checkpoint_updates(section: CheckpointUpdates) -> InventoryResult:
'type': update.type, 'type': update.type,
'status': update.status, 'status': update.status,
'recommended': update.recommended, 'recommended': update.recommended,
'available_since': update.availablesince[:10], 'available_since': update.available_since[:10],
'installed_at': installedat, 'installed_at': installed_at,
}, },
) )
......
#!/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.updates:': {
'title': _('Updates'),
'keyorder': [
'file_name',
'type',
'status',
'recommended',
'available_since',
'installed_at',
'description'
],
'view': 'invcheckpointupdates_of_host',
},
})
declare_invtable_view(
'invcheckpointupdates',
'.software.check_point.updates:',
_('Check Point updates'),
_('Check Point updates'),
)
No preview for this file type
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
'- 2021-02-08: initial release\n', '- 2021-02-08: initial release\n',
'download_url': 'https://thl-cmk.hopto.org', 'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['inv_checkpoint_updates.py'], 'files': {'agent_based': ['inv_checkpoint_updates.py'],
'web': ['plugins/views/inv_checkpoint_updates.py']}, 'gui': ['views/inv_checkpoint_updates.py']},
'name': 'inv_checkpoint_updates', 'name': 'inv_checkpoint_updates',
'num_files': 2,
'title': 'Check Point appliance avilable updates inventory plugin', 'title': 'Check Point appliance avilable updates inventory plugin',
'version': '20210208.v.0.1', 'version': '0.2.1-20230423',
'version.min_required': '2.0.0', 'version.min_required': '2.1.0b1',
'version.packaged': '2021.09.20', 'version.packaged': '2.1.0p21',
'version.usable_until': None} '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