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

update project

parent 0b486645
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@
#
# 2021-02-25: rewrite for CMK 2.x
# added warning/critical is chassis grade not equeal maxGrade
# 2021-09-10: rewrite parse function
#
# ToDo: add warning if SGM/Chassis is missing compared to inventory time
#
......@@ -65,15 +66,15 @@
#
from pprint import pprint
from typing import Mapping, Dict, List, Tuple, NamedTuple
from typing import Mapping, Dict, List, Tuple, NamedTuple, Optional
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,
......@@ -112,17 +113,15 @@ class CheckPointASGChassis(NamedTuple):
sgms: List
def parse_checkpoint_asg_chassis(string_table: List[StringTable]) -> CheckPointASGChassis:
chassis = CheckPointASGChassis
def parse_checkpoint_asg_chassis(string_table: List[StringTable]) -> Optional[CheckPointASGChassis]:
try:
chassis.info = CheckPointASGChassisInfo(*string_table[0][0])
except TypeError:
return None
chassis.chassis = string_table[1]
chassis.sgms = string_table[2]
parsed = chassis
return parsed
return CheckPointASGChassis(
info=CheckPointASGChassisInfo(*string_table[0][0]),
chassis=string_table[1],
sgms=string_table[2]
)
except (TypeError, IndexError):
pass
def discovery_checkpoint_asg_chassis(section: CheckPointASGChassis) -> DiscoveryResult:
......@@ -152,7 +151,7 @@ def check_checkpoint_asg_chassis(params, section: CheckPointASGChassis) -> Check
if not chassis.status.lower() in ['active', 'standby'] or chassis.grade != chassis.maxgrade:
yield Result(state=State.CRIT, summary=yield_text)
elif (chassis.status != inv_chassis.status) or (chassis.grade != inv_chassis.grade) or (chassis.maxgrade != inv_chassis.maxgrade):
yield Result(State.WARN, notice=yield_text + ' (expected: %s, grade: %s/%s)' % (inv_chassis.status, inv_chassis.grade, inv_chassis.maxgrade))
yield Result(state=State.WARN, notice=yield_text + ' (expected: %s, grade: %s/%s)' % (inv_chassis.status, inv_chassis.grade, inv_chassis.maxgrade))
else:
yield Result(state=State.OK, summary=yield_text)
......
No preview for this file type
......@@ -9,5 +9,5 @@
'title': 'Check Point Maestro SMO ASG Chassis',
'version': '20210225.v0.2',
'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