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

update project

parent 96b348b9
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# #
# 2021-03-01: rewrite for CMK 2.x # 2021-03-01: rewrite for CMK 2.x
# 2021-03-03: fixed date/time in parse function # 2021-03-03: fixed date/time in parse function
# 2021-09-10: fixed duplicate detail output
# #
# sample snmpwalk for one passed asg test # sample snmpwalk for one passed asg test
# .1.3.6.1.4.1.2620.1.48.31.1.1.1.21.0 = Wrong Type (should be OCTET STRING): Gauge32: 21 # .1.3.6.1.4.1.2620.1.48.31.1.1.1.21.0 = Wrong Type (should be OCTET STRING): Gauge32: 21
...@@ -73,13 +74,13 @@ ...@@ -73,13 +74,13 @@
from typing import Mapping, Dict, List, Tuple, NamedTuple from typing import Mapping, Dict, List, Tuple, NamedTuple
from .agent_based_api.v1.type_defs import ( from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult, DiscoveryResult,
CheckResult, CheckResult,
StringTable, StringTable,
) )
from .agent_based_api.v1 import ( from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register, register,
Service, Service,
equals, equals,
...@@ -91,6 +92,7 @@ from .agent_based_api.v1 import ( ...@@ -91,6 +92,7 @@ from .agent_based_api.v1 import (
any_of, any_of,
) )
class CheckPointASGDiagSummary(NamedTuple): class CheckPointASGDiagSummary(NamedTuple):
date: str date: str
time: str time: str
...@@ -98,6 +100,7 @@ class CheckPointASGDiagSummary(NamedTuple): ...@@ -98,6 +100,7 @@ class CheckPointASGDiagSummary(NamedTuple):
maxtest: int maxtest: int
failed: list failed: list
class CheckPointASGDiag(NamedTuple): class CheckPointASGDiag(NamedTuple):
summary: CheckPointASGDiagSummary summary: CheckPointASGDiagSummary
tests: List tests: List
...@@ -106,22 +109,20 @@ class CheckPointASGDiag(NamedTuple): ...@@ -106,22 +109,20 @@ class CheckPointASGDiag(NamedTuple):
def parse_checkpoint_asg_diag(string_table: List[StringTable]) -> CheckPointASGDiag: def parse_checkpoint_asg_diag(string_table: List[StringTable]) -> CheckPointASGDiag:
asgSummary, asgTests = string_table asgSummary, asgTests = string_table
if len(asgSummary) == 0: # ToDo: change date to real date string, and add warn/crit if last run to old
return None
if len(asgSummary) != 0:
asgSummary = asgSummary[0][0] asgSummary = asgSummary[0][0]
return CheckPointASGDiag(
parsed = CheckPointASGDiag summary=CheckPointASGDiagSummary(
parsed.summary = CheckPointASGDiagSummary date=asgSummary[3:13],
# todo: change date to real date string, and add warn/crit if last run to old time=asgSummary[18:26],
parsed.summary.date = asgSummary[3:13] passed=int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[0]),
parsed.summary.time = asgSummary[18:26] maxtest=int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[1]),
parsed.summary.passed = int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[0]) failed=list(map(int, asgSummary.split(':')[-1].strip(' ').split(',')))
parsed.summary.maxtest = int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[1]) ),
parsed.summary.failed = list(map(int, asgSummary.split(':')[-1].strip(' ').split(','))) tests=asgTests
parsed.tests = asgTests )
return parsed
def discovery_checkpoint_asg_diag(section: CheckPointASGDiag) -> DiscoveryResult: def discovery_checkpoint_asg_diag(section: CheckPointASGDiag) -> DiscoveryResult:
...@@ -166,15 +167,6 @@ def check_checkpoint_asg_diag(params, section: CheckPointASGDiag) -> CheckResult ...@@ -166,15 +167,6 @@ def check_checkpoint_asg_diag(params, section: CheckPointASGDiag) -> CheckResult
if len(asg_diag_ignore) > 0: if len(asg_diag_ignore) > 0:
summary += ', Ignored tests: %s' % ','.join(map(str, asg_diag_ignore)) summary += ', Ignored tests: %s' % ','.join(map(str, asg_diag_ignore))
for test in section.tests:
test = CheckPointASGDiagTest(*test)
if test.comment == '':
details += '\nIndex: %s, Name: %s, LastRun: %s, Restult: %s' % (
test.index, test.name, test.lastrun, test.result)
else:
details += '\nIndex: %s, Name: %s, LastRun: %s, Restult: %s, Comment: %s' % (
test.index, test.name, test.result, test.result, test.comment)
for test in section.summary.failed: for test in section.summary.failed:
if not test in asg_diag_ignore: if not test in asg_diag_ignore:
if test in asg_diag_warning: if test in asg_diag_warning:
...@@ -223,4 +215,4 @@ register.check_plugin( ...@@ -223,4 +215,4 @@ register.check_plugin(
check_function=check_checkpoint_asg_diag, check_function=check_checkpoint_asg_diag,
check_default_parameters={}, check_default_parameters={},
check_ruleset_name='checkpoint_asg_diag', check_ruleset_name='checkpoint_asg_diag',
) )
\ No newline at end of file
No preview for this file type
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
'title': 'Check Point Maestro SMO ASG Diag', 'title': 'Check Point Maestro SMO ASG Diag',
'version': '20210301.v0.1', 'version': '20210301.v0.1',
'version.min_required': '2.0.0b8', 'version.min_required': '2.0.0b8',
'version.packaged': '2.0.0p1', 'version.packaged': '2021.07.14',
'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