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

update project

parent 5d3b5222
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
# ToDo: add wato with lower/upper levels
#
# 2021-03-02: rewrite for CMK 2.0
# 2021-09-10: rewrite parse function
#
# sample snmpwalk (for one existing SGM)
# .1.3.6.1.4.1.2620.1.48.20.24.1.1.1.0 = Gauge32: 1
......@@ -49,15 +50,15 @@
#
from typing import Mapping, Dict, List, Tuple, NamedTuple
from typing import Dict, List, NamedTuple
from .agent_based_api.v1.type_defs import (
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
StringTable,
CheckResult,
)
from .agent_based_api.v1 import (
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
equals,
......@@ -78,22 +79,21 @@ class CheckPointASGPathDistribution(NamedTuple):
asgDropped: int
def parse_checkpoint_asg_path_distribution(string_table: List[StringTable]) -> Dict:
def parse_checkpoint_asg_path_distribution(string_table: List[StringTable]) -> Dict[str, CheckPointASGPathDistribution]:
parsed = {}
for entry in string_table[0]:
asgStatName, asgAccelPath, asgMediumPath, asgFirewallPath, asgDropped = entry
item = '%s' % (asgStatName)
parsed.update({item: CheckPointASGPathDistribution(
parsed[asgStatName] = CheckPointASGPathDistribution(
int(asgAccelPath),
int(asgMediumPath),
int(asgFirewallPath),
int(asgDropped)
)})
)
return parsed
def discovery_checkpoint_asg_path_distribution(section: Dict) -> DiscoveryResult:
def discovery_checkpoint_asg_path_distribution(section: Dict[str, CheckPointASGPathDistribution]) -> DiscoveryResult:
# sample section
# {
# 'Packet rate': CheckPointASGPathDistribution(asgAccelPath=50, asgMediumPath=34, asgFirewallPath=0, asgDropped=0),
......@@ -105,44 +105,41 @@ def discovery_checkpoint_asg_path_distribution(section: Dict) -> DiscoveryResult
yield Service(item=item)
def check_checkpoint_asg_path_distribution(item, params, section: Dict) -> CheckResult:
def check_checkpoint_asg_path_distribution(item, params, section: Dict[str, CheckPointASGPathDistribution]) -> CheckResult:
try:
entry = section[item]
if params:
pass
yield from check_levels(
entry.asgAccelPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration',
label='Acceleration',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgMediumPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_medium',
label='Medium',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgFirewallPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_firewall',
label='Firewall',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgDropped,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_dropped',
label='Dropped',
render_func=lambda v: str(v),
)
except KeyError:
pass
yield Result(state=State.UNKNOWN, notice='Item not found in SNMP data')
return
yield from check_levels(
entry.asgAccelPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration',
label='Acceleration',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgMediumPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_medium',
label='Medium',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgFirewallPath,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_firewall',
label='Firewall',
render_func=lambda v: str(v),
)
yield from check_levels(
entry.asgDropped,
# levels_upper=disk_usage_upper,
metric_name='checkpoint_asg_path_distribution_acceleration_dropped',
label='Dropped',
render_func=lambda v: str(v),
)
register.snmp_section(
......
No preview for this file type
......@@ -11,5 +11,5 @@
'title': 'Check Point Maestro SMO path distribution counters',
'version': '20201110.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