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

update project

parent d6eefa97
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 : 2016-03-31
#
# Monitors Cisco WLC temperature sensor
#
# tested with WLC2504, WLC5520
#
# 2016-07-02: fixed crit/warn to >=
# 2018-09-14: workaround for wrong data from Mobility Express Controller --> removed
# 2021-07-15: rewritten for CMK 2.0
#
# sample snmpwalk
#
# .1.3.6.1.4.1.14179.2.3.1.12.0 = STRING: "1"
# .1.3.6.1.4.1.14179.2.3.1.13.0 = STRING: "18"
# .1.3.6.1.4.1.14179.2.3.1.14.0 = STRING: "10"
# .1.3.6.1.4.1.14179.2.3.1.15.0 = STRING: "38"
#
# sample string_table
#
# [['1', '18', '10', '38']]
#
from dataclasses import dataclass
from typing import 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,
Result,
SNMPTree,
contains,
State,
check_levels,
)
@dataclass
class CiscoWlcTemp:
environment: str
current: int
lowlimit: float
highlimit: float
_wlc_temp_environment = {
'0': 'unknown',
'1': 'commercial',
'2': 'industrial',
}
def parse_cisco_wlc_temp(string_table: StringTable) -> Optional[CiscoWlcTemp]:
try:
environment, temperature, lowlimit, highlimit = string_table[0]
except IndexError:
return
temperature = int(temperature)
highlimit = int(highlimit)
lowlimit = int(lowlimit)
environment = _wlc_temp_environment.get(environment)
return CiscoWlcTemp(
environment=environment,
current=temperature,
lowlimit=lowlimit,
highlimit=highlimit,
)
def discovery_cisco_wlc_temp(section: CiscoWlcTemp) -> DiscoveryResult:
yield Service()
def check_cisco_wlc_temp(params, section: CiscoWlcTemp) -> CheckResult:
yield from check_levels(
value=section.current,
label='Temperature',
levels_upper=params['levels_upper'],
levels_lower=params['levels_lower'],
render_func=lambda v: f'{v}°C',
metric_name='temp',
boundaries=(0, 100),
)
yield Result(state=State.OK,
notice=f'Lower/upper levels reported by the device: {section.lowlimit}°C/{section.highlimit}°C')
yield Result(state=State.OK, notice=f'Environment type reported by the device: {section.environment}')
register.snmp_section(
name='cisco_wlc_temp',
parse_function=parse_cisco_wlc_temp,
fetch=SNMPTree(
base='.1.3.6.1.4.1.14179.2.3.1', # AIRESPACE-WIRELESS-MIB::bsnGlobalDot11Config
oids=[
'12', # bsnOperatingTemperatureEnvironment
'13', # bsnSensorTemperature (Current Internal Temperature of the unit in Centigrade)
'14', # bsnTemperatureAlarmLowLimit
'15', # bsnTemperatureAlarmHighLimit
]
),
detect=contains('.1.3.6.1.2.1.1.1.0', 'Cisco Controller'), # sysDescr
)
register.check_plugin(
name='cisco_wlc_temp',
service_name='Temperature',
discovery_function=discovery_cisco_wlc_temp,
check_function=check_cisco_wlc_temp,
check_default_parameters={'levels_upper': (36, 38), 'levels_lower': (12, 10)},
check_ruleset_name='cisco_wlc_temp',
)
title: Cisco WLC: temperatur sensors title: Cisco WLC: temperature sensor
agents: snmp agents: snmp
author: Th.L. author: Th.L.
catalog: hw/network/cisco catalog: hw/network/cisco
license: GPLv3 license: GPLv3
distribution: unkown distribution: unkown
description: description:
The Cisco "Wireless LAN Controller" (WLC) has some temperatur sensors. The Cisco "Wireless LAN Controller" (WLC) has some temperature sensors.
This check allows to monitor this sensors. Default levels are 60°/70° celsius This check allows to monitor this sensors.
for warning/critical.
The check uses the bsnSensorTemperature from the AIRESPACE-WIRELESS-MIB (1.3.6.1.4.1.14179). The check uses the bsnSensorTemperature from the AIRESPACE-WIRELESS-MIB (1.3.6.1.4.1.14179).
The check is tested against WLC2504 devices. The check is tested against WLC2504 and WLC5520 devices.
perfdata: perfdata:
Temperatur temp
item: item:
One item per temperatur sensor is generated. There is no item.
inventory: inventory:
The check detects WLC temperatur sensors and saves them. The check detects WLC temperature sensors and saves them.
parameters: parameters:
Warning/Critical levels. Default is 60°/70° celsius. lower_levels, default is 12°C/10°C
upper_levels, default is 36°C/38°C
No preview for this file type
{'author': u'Th.L. (thl-cmk[at]outlook[dot]com)', {'author': 'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': u'monitor Cisco WLC temperatur sensor\n\ntested with WLC2504\n', 'description': 'monitor Cisco WLC temperature sensor\n'
'\n'
'tested with WLC2504 and WLC5520\n',
'download_url': 'https://thl-cmk.hopto.org', 'download_url': 'https://thl-cmk.hopto.org',
'files': {'checkman': ['cisco_wlc_temp'], 'files': {'agent_based': ['cisco_wlc_temp.py'],
'checks': ['cisco_wlc_temp'], 'checkman': ['cisco_wlc_temp'],
'web': ['plugins/wato/cisco_wlc_temp.py', 'web': ['plugins/wato/cisco_wlc_temp.py']},
'plugins/metrics/cisco_wlc_temp.py']},
'name': 'cisco_wlc_temp', 'name': 'cisco_wlc_temp',
'num_files': 4, 'num_files': 3,
'title': u'monitor Cisco WLC temperatur sensor', 'title': 'monitor Cisco WLC temperature sensor',
'version': '20180805.v.0.0.1', 'version': '20210715.v.0.2',
'version.min_required': '1.2.8b8', 'version.min_required': '2.0.0',
'version.packaged': '1.6.0p12', 'version.packaged': '2021.07.14',
'version.usable_until': None} 'version.usable_until': None}
\ No newline at end of file
#!/usr/bin/python #!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*- # -*- coding: utf-8 -*-
# #
# Author : Th.L. # License: GNU General Public License v2
# Content: wato plugin for snmp check 'cisco_wlc_temp'
# to configure waring/critical levels
# #
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2016-03-31
# #
register_check_parameters( # WATO for plugin cisco_wlc_temp
subgroup_environment, #
'cisco_wlc_temp', #
_('Cisco WLC temperatur sensor'),
Tuple( from cmk.gui.i18n import _
title=_('Cisco WLC temperatur sensor thresholds'), from cmk.gui.valuespec import (
elements=[ Dictionary,
Integer(title=_('warning at'), unit=_(u'° celsius'), default_value=50), Tuple,
Integer(title=_('critical at'), unit=_(u'° celsius'), default_value=60), Integer,
] )
),
None, from cmk.gui.plugins.wato import (
None CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersNetworking,
) )
def _parameter_valuespec_cisco_wlc_temp():
return Dictionary(elements=[
('levels_upper',
Tuple(
title=_('Temperature upper levels'),
help=_('Set the upper levels for temperature in °C. From the MID description: '
'Operating Environment of the Airespace Switch. commercial is Commercial (0 to 40 C) '
'and industrial is Industrial (-10 to 70 C)'),
elements=[
Integer(title=_('Warning at'), unit=u'°C', default_value=36, minvalue=-20, maxvalue=100),
Integer(title=_('Critical at'), unit=u'°C', default_value=38, minvalue=-20, maxvalue=100)
],
),
),
('levels_lower',
Tuple(
title=_('Temperature lower levels'),
help=_('Set the lower levels for temperature in °C From the MID description: '
'Operating Environment of the Airespace Switch. commercial is Commercial (0 to 40 C) '
'and industrial is Industrial (-10 to 70 C)'),
elements=[
Integer(title=_('Warning below'), unit=u'°C', default_value=12, minvalue=-20, maxvalue=100),
Integer(title=_('Critical below'), unit=u'°C', default_value=10, minvalue=-20, maxvalue=100)
],
),
),
])
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name='cisco_wlc_temp',
group=RulespecGroupCheckParametersNetworking,
match_type='dict',
parameter_valuespec=_parameter_valuespec_cisco_wlc_temp,
title=lambda: _('Cisco WLC Temperature'),
))
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