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

removed unused ruleset definition and default parameters

parent 5bce1919
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/juniper_led-0.0.2-20230603.mkp "juniper_led-0.0.2-20230603.mkp" [PACKAGE]: ../../raw/master/mkp/juniper_led-0.0.3-20250117.mkp "juniper_led-0.0.3-20250117.mkp"
# Juniper LED state # Juniper LED state
Monitors the state of the Juniper LEDs using the JUNIPER-MIB. Monitors the state of the Juniper LEDs using the JUNIPER-MIB.
......
File added
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
# Date : 2016-08-01 # Date : 2016-08-01
# #
# monitor Juniper Networks led state # monitor Juniper Networks led state
#
# 2025-01-17: removed unused ruleset definition and default parameters (ThX to nick[at]fisk[dot]me[dot]uk)
# #
# sample snmpwalk # sample snmpwalk
# .1.3.6.1.4.1.2636.3.1.10.1.7.3.1.1.0.0 = STRING: " chassis alarm LED" # .1.3.6.1.4.1.2636.3.1.10.1.7.3.1.1.0.0 = STRING: " chassis alarm LED"
...@@ -25,19 +28,19 @@ ...@@ -25,19 +28,19 @@
# #
# ToDo: create WATO for monitoring levels for each LED state # ToDo: create WATO for monitoring levels for each LED state
# #
from typing import Optional, Dict from typing import Dict, Optional
from cmk.base.plugins.agent_based.agent_based_api.v1 import ( from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
Result, Result,
State,
SNMPTree, SNMPTree,
Service,
State,
register,
startswith, startswith,
) )
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
CheckResult, CheckResult,
DiscoveryResult,
StringTable, StringTable,
) )
...@@ -58,12 +61,13 @@ _juniper_led_alarm_ordered = { ...@@ -58,12 +61,13 @@ _juniper_led_alarm_ordered = {
def parse_juniper_led(string_table: StringTable) -> Optional[Dict[str, str]]: def parse_juniper_led(string_table: StringTable) -> Optional[Dict[str, str]]:
juniper_leds = {} juniper_leds: Dict[str, str] = {}
for led_description, led_state in string_table: for led_description, led_state in string_table:
# remove "LED" from description # remove "LED" from description
led_description = led_description.replace('LED', '').strip(' ') led_description: str = led_description.replace('LED', '').strip(' ')
# changing the first letter into upper case # changing only the first letter into upper case (title() will change every first char,
# capitalize() will lower case inheriting except the first char)
led_description = led_description[0].upper() + led_description[1:] led_description = led_description[0].upper() + led_description[1:]
juniper_leds[led_description] = led_state juniper_leds[led_description] = led_state
...@@ -76,8 +80,8 @@ def discovery_juniper_led(section: Dict[str, str]) -> DiscoveryResult: ...@@ -76,8 +80,8 @@ def discovery_juniper_led(section: Dict[str, str]) -> DiscoveryResult:
yield Service(item=led) yield Service(item=led)
def check_juniper_led(item, params, section: Dict[str, str]) -> CheckResult: def check_juniper_led(item, section: Dict[str, str]) -> CheckResult:
led_state = section.get(item) led_state: str = section.get(item)
if led_state: if led_state:
state, state_readable = _juniper_led_alarm_ordered.get(led_state, (3, f'unhandled alarm type {led_state}')) state, state_readable = _juniper_led_alarm_ordered.get(led_state, (3, f'unhandled alarm type {led_state}'))
yield Result(state=State(state), summary=state_readable) yield Result(state=State(state), summary=state_readable)
...@@ -103,7 +107,4 @@ register.check_plugin( ...@@ -103,7 +107,4 @@ register.check_plugin(
service_name='Alarm LED %s', service_name='Alarm LED %s',
discovery_function=discovery_juniper_led, discovery_function=discovery_juniper_led,
check_function=check_juniper_led, check_function=check_juniper_led,
check_ruleset_name='juniper_led',
check_default_parameters={
}
) )
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
'files': {'agent_based': ['juniper_led.py']}, 'files': {'agent_based': ['juniper_led.py']},
'name': 'juniper_led', 'name': 'juniper_led',
'title': 'Juniper Alarm LEDs', 'title': 'Juniper Alarm LEDs',
'version': '0.0.2-20230603', 'version': '0.0.3-20250117',
'version.min_required': '2.0.0b1', 'version.min_required': '2.0.0b1',
'version.packaged': '2.2.0p24', 'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': None} 'version.usable_until': None}
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