Hi,
I’ve got a simple custom snmp check to check the status of a raid. The check works as expected and I can see the status chaning depending on the raids “health” status.
However I’ve noticed that when going into the service discovery page of my host the custom check/service state is UNKN and checkmk is reporting that the check plugin received no monitoring data. Am I missing something?
custom check
#!/usr/bin/env python3
from .agent_based_api.v1 import register, Result, Service, contains, SNMPTree, State
def parse_nas_raid_check(string_table):
result = {}
result['raid_status'] = string_table[0][0]
return result
def discover_nas_raid_check(section):
yield Service()
def check_nas_raid_check(section):
if section['raid_status'] == 'Degraded':
yield Result(state=State.WARN, summary="Raid is degraded")
elif section['raid_status'] == 'Ready':
yield Result(state=State.OK, summary="Raid is OK")
register.snmp_section(
name = "nas_raid_status",
parse_function = parse_nas_raid_check,
detect = contains(".1.3.6.1.4.1.24681.1.2.13", "my-nas"),
fetch = SNMPTree(
base='.1.3.6.1.4.1.24681.1.4.1.1.1.2.1.2.1.5',
oids=['1']
),
)
register.check_plugin(
name = "nas_raid_check",
sections = ["nas_raid_status"],
service_name = "Raid Status",
discovery_function = discover_nas_raid_check,
check_function = check_nas_raid_check,
)
Monitor > Overview > All hosts > myhost
Setup > Hosts > Main > myhost