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

update project

parent ef6b704a
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
# ['50', '1 2'] # ['50', '1 2']
# ], # ],
# [ # [
# ['0', 'k01001s11-017500009', '1', '1', 'OK', 'Primary chassis health is good.', '2', '2', '1', '1', '', ''] # ['0', 'k01001s11-017500009', '1', '1', 'OK', 'Primary chassis health is good.', '2', '2', '1', '1']
# ] # ]
# ] # ]
# #
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
# VsPrimaryChassis='1', VsActiveChassis='1', VsHealth='OK', # VsPrimaryChassis='1', VsActiveChassis='1', VsHealth='OK',
# VsReason='Primary chassis health is good.', ChassisState=[(2, 2), (1, 1)]) # VsReason='Primary chassis health is good.', ChassisState=[(2, 2), (1, 1)])
from typing import List, Tuple, Optional from typing import List, NamedTuple, Optional
from dataclasses import dataclass from dataclasses import dataclass
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 (
DiscoveryResult, DiscoveryResult,
...@@ -66,17 +66,24 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( ...@@ -66,17 +66,24 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
) )
class CheckpoinstAsgVlslChassis(NamedTuple):
InterfacesUp: int
InterfacesTotal: int
FwksUp: int
FwksTotal: int
@dataclass @dataclass
class CheckpointAsgVsls: class CheckpointAsgVsls:
SgmRatio: str SgmRatio: str
SystemPrimaryChassis: str SystemPrimaryChassis: list
Vsid: str Vsid: str
VsName: str VsName: str
VsPrimaryChassis: str VsPrimaryChassis: str
VsActiveChassis: str VsActiveChassis: str
VsHealth: str VsHealth: str
VsReason: str VsReason: str
ChassisState: List[Tuple[int, int]] ChassisState: List[CheckpoinstAsgVlslChassis]
def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[CheckpointAsgVsls]: def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[CheckpointAsgVsls]:
...@@ -87,14 +94,15 @@ def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[Check ...@@ -87,14 +94,15 @@ def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[Check
return return
try: try:
Vsid, VsName, VsPrimaryChassis, VsActiveChassis, VsHealth, VsReason, VsChassis1FwksUp, VsChassis1FwksTotal, \ Vsid, VsName, VsPrimaryChassis, VsActiveChassis, VsHealth, VsReason, \
VsChassis2FwksUp, VsChassis2FwksTotal, VsChassis3FwksUp, VsChassis3FwksTotal = chassis_state[0] VsChassis1InterfacesUp, VsChassis1InterfacesTotal, VsChassis1FwksUp, VsChassis1FwksTotal, \
VsChassis2InterfacesUp, VsChassis2InterfacesTotal, VsChassis2FwksUp, VsChassis2FwksTotal, = chassis_state[0]
except (IndexError, ValueError): except (IndexError, ValueError):
return return
return CheckpointAsgVsls( return CheckpointAsgVsls(
SgmRatio=SgmRatio, SgmRatio=SgmRatio,
SystemPrimaryChassis=SystemPrimaryChassis, SystemPrimaryChassis=SystemPrimaryChassis.strip(),
Vsid=Vsid, Vsid=Vsid,
VsName=VsName, VsName=VsName,
VsPrimaryChassis=VsPrimaryChassis, VsPrimaryChassis=VsPrimaryChassis,
...@@ -102,9 +110,18 @@ def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[Check ...@@ -102,9 +110,18 @@ def parse_checkpoint_asg_vsls(string_table: List[StringTable]) -> Optional[Check
VsHealth=VsHealth, VsHealth=VsHealth,
VsReason=VsReason, VsReason=VsReason,
ChassisState=[ ChassisState=[
(int(VsChassis1FwksUp), int(VsChassis1FwksTotal)), CheckpoinstAsgVlslChassis(
(int(VsChassis2FwksUp), int(VsChassis2FwksTotal)), int(VsChassis1InterfacesUp),
# (int(VsChassis3FwksUp), int(VsChassis3FwksTotal)), int(VsChassis1InterfacesTotal),
int(VsChassis1FwksUp),
int(VsChassis1FwksTotal)
),
CheckpoinstAsgVlslChassis(
int(VsChassis2InterfacesUp),
int(VsChassis2InterfacesTotal),
int(VsChassis2FwksUp),
int(VsChassis2FwksTotal)
),
] ]
) )
...@@ -114,10 +131,11 @@ def discovery_checkpoint_asg_vsls(section: CheckpointAsgVsls) -> DiscoveryResult ...@@ -114,10 +131,11 @@ def discovery_checkpoint_asg_vsls(section: CheckpointAsgVsls) -> DiscoveryResult
def check_checkpoint_asg_vsls(params, section: CheckpointAsgVsls) -> CheckResult: def check_checkpoint_asg_vsls(params, section: CheckpointAsgVsls) -> CheckResult:
SystemPrimaryChassis = section.SystemPrimaryChassis.strip().split(' ')
inv_asgVslsVsActiveChassis = params['discovery_active_chassis'] inv_asgVslsVsActiveChassis = params['discovery_active_chassis']
longoutput = '' longoutput = ''
longoutput += f'\nThreshold ratio for failover: {section.SgmRatio}'
longoutput += f'\nMethod for defaulting Chassis per each VS: {section.SystemPrimaryChassis}'
longoutput += f'\nSystem name: {section.VsName}' longoutput += f'\nSystem name: {section.VsName}'
longoutput += f'\nHealth status: {section.VsHealth}' longoutput += f'\nHealth status: {section.VsHealth}'
longoutput += f'\nHealth reason: {section.VsReason}' longoutput += f'\nHealth reason: {section.VsReason}'
...@@ -132,14 +150,20 @@ def check_checkpoint_asg_vsls(params, section: CheckpointAsgVsls) -> CheckResult ...@@ -132,14 +150,20 @@ def check_checkpoint_asg_vsls(params, section: CheckpointAsgVsls) -> CheckResult
else: else:
yield Result(state=State.OK, notice=yield_text) yield Result(state=State.OK, notice=yield_text)
for chassis in SystemPrimaryChassis: chassis = 0
VsChassisFwksUp, VsChassisFwksTotal = section.ChassisState[int(chassis) - 1] for InterfacesUp, InterfacesTotal, VsChassisFwksUp, VsChassisFwksTotal in section.ChassisState:
yield_text = f'Chassis {chassis}: {VsChassisFwksUp}/{VsChassisFwksTotal} SGMs UP' chassis += 1
yield_text = f'Chassis {chassis}: {VsChassisFwksUp}/{VsChassisFwksTotal} SGMs Up'
if VsChassisFwksUp != VsChassisFwksTotal: if VsChassisFwksUp != VsChassisFwksTotal:
yield Result(state=State.CRIT, notice=yield_text) yield Result(state=State.CRIT, notice=yield_text)
else: else:
yield Result(state=State.OK, summary=yield_text) yield Result(state=State.OK, summary=yield_text)
yield_text = f'Interfaces: {InterfacesUp}/{InterfacesTotal} (Up/Total)'
if InterfacesUp != InterfacesTotal:
yield Result(state=State.CRIT, notice=yield_text)
else:
yield Result(state=State.OK, summary=yield_text)
register.snmp_section( register.snmp_section(
name='checkpoint_asg_vsls', name='checkpoint_asg_vsls',
...@@ -161,12 +185,14 @@ register.snmp_section( ...@@ -161,12 +185,14 @@ register.snmp_section(
'4', # asgVslsVsActiveChassis '4', # asgVslsVsActiveChassis
'5', # asgVslsVsHealth '5', # asgVslsVsHealth
'6', # asgVslsVsReason '6', # asgVslsVsReason
'7', # asgVslsVsChassis1InterfacesUp
'8', # asgVslsVsChassis1InterfacesTotal
'9', # asgVslsVsChassis1FwksUp '9', # asgVslsVsChassis1FwksUp
'10', # asgVslsVsChassis1FwksTotal '10', # asgVslsVsChassis1FwksTotal
'21', # asgVslsVsChassis2InterfacesUp
'22', # asgVslsVsChassis2InterfacesTotal
'23', # asgVslsVsChassis2FwksUp '23', # asgVslsVsChassis2FwksUp
'24', # asgVslsVsChassis2FwksTotal '24', # asgVslsVsChassis2FwksTotal
'33', # asgVslsVsChassis3FwksUp
'34', # asgVslsVsChassis3FwksTotal
] ]
), ),
], ],
......
No preview for this file type
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
'title': 'Check Point Maestro SMO ASG VSLS Chassis', 'title': 'Check Point Maestro SMO ASG VSLS Chassis',
'version': '20210911.v0.2', 'version': '20210911.v0.2',
'version.min_required': '2.0.0', 'version.min_required': '2.0.0',
'version.packaged': '2021.07.14', 'version.packaged': '2021.09.20',
'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