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 @@
# 2020-06-08: changed snmp-scan function
# 2021-08-10: rewritten for CMK 2.0
# added WATO
# 2023-04-23: refactoring
#
#
# ToDo: remove VSX...
......@@ -30,12 +31,6 @@
# .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
......@@ -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]:
powersupplys = {}
for psindex, psstatus in string_table:
if psindex.isdigit():
powersupplys.update({psindex: psstatus})
"""
>>> print(parse_checkpoint_powersupply([['1', 'Up'], ['2', 'Up']]))
{'1': 'Up', '2': 'Up'}
>>> 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:
......@@ -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]:
try:
psstatus = section[item]
ps_status = section[item]
except KeyError:
return
if psstatus.lower() in ['up', 'present']:
yield Result(state=State.OK, summary=f'Status: {psstatus}')
if ps_status.lower() in ['up', 'present']:
yield Result(state=State.OK, summary=f'Status: {ps_status}')
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(
......
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 @@
'WATO\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['checkpoint_powersupply.py'],
'checkman': ['checkpoint_powersupply'],
'web': ['plugins/wato/checkpoint_powersupply.py']},
'gui': ['wato/checkpoint_powersupply.py']},
'name': 'checkpoint_powersupply',
'num_files': 3,
'title': 'Check Point power supply status',
'version': '20210810.v0.0.2',
'version.min_required': '2.0.0',
'version.packaged': '2021.09.20',
'version': '1.0.1-20230423',
'version.min_required': '2.1.0b1',
'version.packaged': '2.1.0p21',
'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