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

update project

parent 3866fd92
No related branches found
No related tags found
No related merge requests found
#!/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 : 2018-07-31
#
# Monitor status of Check Point appliance power supply
#
# 2020-06-08: changed snmp-scan function
# 2021-08-10: rewritten for CMK 2.0
# added WATO
#
#
# ToDo: remove VSX...
#
# sample snmpwalk (two power supplys)
#
# CHECKPOINT-MIB::powerSupplyIndex.1.0 = INTEGER: 1
# CHECKPOINT-MIB::powerSupplyIndex.2.0 = INTEGER: 2
# CHECKPOINT-MIB::powerSupplyStatus.1.0 = STRING: Up
# CHECKPOINT-MIB::powerSupplyStatus.2.0 = STRING: Up
#
#
# .1.3.6.1.4.1.2620.1.6.7.9.1.1.1.1.0 = INTEGER: 1
# .1.3.6.1.4.1.2620.1.6.7.9.1.1.1.2.0 = INTEGER: 2
# .1.3.6.1.4.1.2620.1.6.7.9.1.1.2.1.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 cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
CheckResult,
StringTable,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
equals,
Result,
State,
SNMPTree,
startswith,
all_of,
any_of,
)
def parse_checkpoint_powersupply(string_table: StringTable) -> Dict[str, str]:
powersupplys = {}
for psindex, psstatus in string_table:
if psindex.isdigit():
powersupplys.update({psindex: psstatus})
return powersupplys
def discovery_checkpoint_powersupply(section: Dict[str, str]) -> DiscoveryResult:
for key in section.keys():
yield Service(item=key)
def check_checkpoint_powersupply(item, params, section: Dict[str, str]) -> Optional[CheckResult]:
try:
psstatus = section[item]
except KeyError:
return
if psstatus.lower() in ['up', 'present']:
yield Result(state=State.OK, summary=f'Status: {psstatus}')
else:
yield Result(state=State(params['ps_not_up']), summary=f'Status: {psstatus}')
register.snmp_section(
name='checkpoint_powersupply',
parse_function=parse_checkpoint_powersupply,
fetch=SNMPTree(
base='.1.3.6.1.4.1.2620.1.6.7.9.1.1', # CHECKPOINT-MIB::powerSupplyEntry
oids=[
'1', # powerSupplyIndex
'2', # powerSupplyStatus
]
),
detect=any_of(
startswith('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.2620'),
all_of(
equals('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.8072.3.2.10'),
equals('.1.3.6.1.4.1.2620.1.6.1.0', 'SVN Foundation'),
)
)
)
register.check_plugin(
name='checkpoint_powersupply',
service_name='Power Supply %s',
discovery_function=discovery_checkpoint_powersupply,
check_function=check_checkpoint_powersupply,
check_default_parameters={
'ps_not_up': 2
},
check_ruleset_name='checkpoint_powersupply',
)
No preview for this file type
{'author': u'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': u'Monitor Check Point appliance power supply status\n\n- critical if state not "up".\n- no perfdata\n- no wato\n',
{'author': 'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': 'Monitor Check Point appliance power supply status\n'
'\n'
'critical if state not "Up"/"Present", can be configured via '
'WATO\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'checks': ['checkpoint_powersupply']},
'files': {'agent_based': ['checkpoint_powersupply.py'],
'checkman': ['checkpoint_powersupply'],
'web': ['plugins/wato/checkpoint_powersupply.py']},
'name': 'checkpoint_powersupply',
'num_files': 1,
'title': u'Check Point power supply status',
'version': '20180731.v0.0.1',
'version.min_required': '1.2.8b8',
'version.packaged': '1.4.0p38'}
\ No newline at end of file
'num_files': 3,
'title': 'Check Point power supply status',
'version': '20210810.v0.0.2',
'version.min_required': '2.0.0',
'version.packaged': '2021.07.14',
'version.usable_until': None}
\ No newline at end of file
#!/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
#
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
TextAscii,
MonitoringState,
)
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersNetworking,
)
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=RulespecGroupCheckParametersNetworking,
item_spec=lambda: TextAscii(title=_('Power Supply index'), ),
match_type='dict',
parameter_valuespec=_parameter_valuespec_checkpoint_powersupply,
title=lambda: _('Check Point Power Supply'),
))
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