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 @@
#
# 2021-03-01: rewrite for CMK 2.x
# 2021-03-03: fixed date/time in parse function
# 2021-09-10: fixed duplicate detail output
#
# 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
......@@ -73,13 +74,13 @@
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,
CheckResult,
StringTable,
)
from .agent_based_api.v1 import (
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
equals,
......@@ -91,6 +92,7 @@ from .agent_based_api.v1 import (
any_of,
)
class CheckPointASGDiagSummary(NamedTuple):
date: str
time: str
......@@ -98,6 +100,7 @@ class CheckPointASGDiagSummary(NamedTuple):
maxtest: int
failed: list
class CheckPointASGDiag(NamedTuple):
summary: CheckPointASGDiagSummary
tests: List
......@@ -106,22 +109,20 @@ class CheckPointASGDiag(NamedTuple):
def parse_checkpoint_asg_diag(string_table: List[StringTable]) -> CheckPointASGDiag:
asgSummary, asgTests = string_table
if len(asgSummary) == 0:
return None
asgSummary = asgSummary[0][0]
parsed = CheckPointASGDiag
parsed.summary = CheckPointASGDiagSummary
# todo: change date to real date string, and add warn/crit if last run to old
parsed.summary.date = asgSummary[3:13]
parsed.summary.time = asgSummary[18:26]
parsed.summary.passed = int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[0])
parsed.summary.maxtest = int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[1])
parsed.summary.failed = list(map(int, asgSummary.split(':')[-1].strip(' ').split(',')))
parsed.tests = asgTests
return parsed
# ToDo: change date to real date string, and add warn/crit if last run to old
if len(asgSummary) != 0:
asgSummary = asgSummary[0][0]
return CheckPointASGDiag(
summary=CheckPointASGDiagSummary(
date=asgSummary[3:13],
time=asgSummary[18:26],
passed=int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[0]),
maxtest=int(asgSummary[28:].split(".")[0].split(' ')[1].split('/')[1]),
failed=list(map(int, asgSummary.split(':')[-1].strip(' ').split(',')))
),
tests=asgTests
)
def discovery_checkpoint_asg_diag(section: CheckPointASGDiag) -> DiscoveryResult:
......@@ -166,15 +167,6 @@ def check_checkpoint_asg_diag(params, section: CheckPointASGDiag) -> CheckResult
if len(asg_diag_ignore) > 0:
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:
if not test in asg_diag_ignore:
if test in asg_diag_warning:
......@@ -223,4 +215,4 @@ register.check_plugin(
check_function=check_checkpoint_asg_diag,
check_default_parameters={},
check_ruleset_name='checkpoint_asg_diag',
)
\ No newline at end of file
)
No preview for this file type
......@@ -12,5 +12,5 @@
'title': 'Check Point Maestro SMO ASG Diag',
'version': '20210301.v0.1',
'version.min_required': '2.0.0b8',
'version.packaged': '2.0.0p1',
'version.packaged': '2021.07.14',
'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