CMK version:2.4.0p24
OS version:Debian
Error message:Unimplemented check ascom_basic_check
Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)
I’m trying to build a check for ascom IPBS3 dect. As far as i understand is the detect function wrong and I can’t figure out why. Below is the code with im trying to test.
PS: the check when i test it works on a spohos firewall.
#!/usr/bin/env python3
from cmk.agent_based.v2 import (
all_of,
CheckPlugin,
CheckResult,
startswith,
DiscoveryResult,
Result,
Service,
SimpleSNMPSection,
SNMPTree,
State,
StringTable,
equals,
)
def parse_ascom(string_table):
print(string_table)
result = {}
result["contact"] = string_table[0][0]
result["name"] = string_table[0][1]
result["location"] = string_table[0][2]
print(result)
return result
def discover_ascom(section):
yield Service()
def check_ascom(section):
missing = 0
for e in ["contact", "name", "location"]:
if section[e] == "":
missing += 1
yield Result(state=State.CRIT, summary=f"Missing information: {e}!")
if missing > 0:
yield Result(state=State.CRIT, summary=f"Missing fields: {missing}!")
else:
yield Result(state=State.OK, summary="All required information is available.")
snmp_section_ascom_setup_check = SimpleSNMPSection(
name = "ascom_basic_config",
parse_function = parse_ascom,
detect = all_of(
equals('.1.3.6.1.2.1.1.2.0', '.1.3.6.1.4.1.27614'),
equals('.1.3.6.1.4.1.27614.1.1.1.3.1.0', 'IPBS3-A3/2A2'),
),
fetch = SNMPTree(
base = '.1.3.6.1.2.1.1',
oids = ['4.0', '5.0', '6.0'],
),
)
check_plugin_ascom_setup_check = CheckPlugin(
name = "ascom_basic_check",
sections = [ "ascom_basic_config" ],
service_name = "Ascom basic check",
discovery_function = discover_ascom,
check_function = check_ascom,
)
Output of the SNMPwalk for the OIDs used.
#.1.3.6.1.2.1.1.1.0 IPBS3[13.1.2], Bootcode[13.1.2], Hardware[IPBS3-A3/2A2]
#.1.3.6.1.2.1.1.2.0 .1.3.6.1.4.1.27614
#.1.3.6.1.2.1.1.3.0 188486800
#.1.3.6.1.2.1.1.4.0 it@xxxxxxx.com
#.1.3.6.1.2.1.1.5.0 BS01_XXX_XXXX
#.1.3.6.1.2.1.1.2.0 .1.3.6.1.4.1.2761
#.1.3.6.1.4.1.27614.1.1.1.3.1.0 IPBS3-A3/2A2
