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

update project

parent 6f70af1e
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# 2020-06-08: changed snmp-scan function # 2020-06-08: changed snmp-scan function
# 2021-08-10: rewritten for CMK 2.0 # 2021-08-10: rewritten for CMK 2.0
# added WATO # added WATO
# 2023-04-23: refactoring
# #
# #
# ToDo: remove VSX... # ToDo: remove VSX...
...@@ -30,12 +31,6 @@ ...@@ -30,12 +31,6 @@
# .1.3.6.1.4.1.2620.1.6.7.9.1.1.2.2.0 = STRING: Up # .1.3.6.1.4.1.2620.1.6.7.9.1.1.2.2.0 = STRING: Up
# #
#
# sample section
# smart-1 5150
# {'1': 'Present', '2': 'Present'}
# 23800 appliance
# {'1': 'Up', '2': 'Up'}
from typing import Dict, Optional from typing import Dict, Optional
...@@ -59,12 +54,18 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import ( ...@@ -59,12 +54,18 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
def parse_checkpoint_powersupply(string_table: StringTable) -> Dict[str, str]: def parse_checkpoint_powersupply(string_table: StringTable) -> Dict[str, str]:
powersupplys = {} """
for psindex, psstatus in string_table: >>> print(parse_checkpoint_powersupply([['1', 'Up'], ['2', 'Up']]))
if psindex.isdigit(): {'1': 'Up', '2': 'Up'}
powersupplys.update({psindex: psstatus}) >>> print(parse_checkpoint_powersupply([['1', 'Present'], ['2', 'Present']]))
{'1': 'Present', '2': 'Present'}
"""
power_supplys = {}
for ps_index, ps_status in string_table:
if ps_index.isdigit():
power_supplys.update({ps_index: ps_status})
return powersupplys return power_supplys
def discovery_checkpoint_powersupply(section: Dict[str, str]) -> DiscoveryResult: def discovery_checkpoint_powersupply(section: Dict[str, str]) -> DiscoveryResult:
...@@ -74,14 +75,14 @@ def discovery_checkpoint_powersupply(section: Dict[str, str]) -> DiscoveryResult ...@@ -74,14 +75,14 @@ def discovery_checkpoint_powersupply(section: Dict[str, str]) -> DiscoveryResult
def check_checkpoint_powersupply(item, params, section: Dict[str, str]) -> Optional[CheckResult]: def check_checkpoint_powersupply(item, params, section: Dict[str, str]) -> Optional[CheckResult]:
try: try:
psstatus = section[item] ps_status = section[item]
except KeyError: except KeyError:
return return
if psstatus.lower() in ['up', 'present']: if ps_status.lower() in ['up', 'present']:
yield Result(state=State.OK, summary=f'Status: {psstatus}') yield Result(state=State.OK, summary=f'Status: {ps_status}')
else: else:
yield Result(state=State(params['ps_not_up']), summary=f'Status: {psstatus}') yield Result(state=State(params['ps_not_up']), summary=f'Status: {ps_status}')
register.snmp_section( register.snmp_section(
......
No preview for this file type
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2021-08-10
#
# 2023-04-23: moved wato file to ~/local/lib/check_mk/gui/plugins/wato
# moved rule set from networking to hardware
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
TextAscii,
MonitoringState,
)
from cmk.gui.plugins.wato.utils import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersHardware,
)
def _parameter_valuespec_checkpoint_powersupply():
return Dictionary(elements=[
('ps_not_up',
MonitoringState(
default_value=2,
title=_('State if power supply is not "UP" or "Present".'),
)),
])
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name='checkpoint_powersupply',
group=RulespecGroupCheckParametersHardware,
item_spec=lambda: TextAscii(title=_('Power Supply index'), ),
match_type='dict',
parameter_valuespec=_parameter_valuespec_checkpoint_powersupply,
title=lambda: _('Check Point Power Supply'),
))
...@@ -5,12 +5,10 @@ ...@@ -5,12 +5,10 @@
'WATO\n', 'WATO\n',
'download_url': 'https://thl-cmk.hopto.org', 'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['checkpoint_powersupply.py'], 'files': {'agent_based': ['checkpoint_powersupply.py'],
'checkman': ['checkpoint_powersupply'], 'gui': ['wato/checkpoint_powersupply.py']},
'web': ['plugins/wato/checkpoint_powersupply.py']},
'name': 'checkpoint_powersupply', 'name': 'checkpoint_powersupply',
'num_files': 3,
'title': 'Check Point power supply status', 'title': 'Check Point power supply status',
'version': '20210810.v0.0.2', 'version': '1.0.1-20230423',
'version.min_required': '2.0.0', 'version.min_required': '2.1.0b1',
'version.packaged': '2021.09.20', 'version.packaged': '2.1.0p21',
'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