CMK version: 2.4.0p16 Enterprise
OS version: Debian Linux 12.12
I have created a simple SNMP-plugin, which only monitors one single value:
#!/usr/bin/env python3
from cmk.agent_based.v2 import *
def check_if_lte_up(section):
if_lte_up = int(section["if_lte_up"])
if(if_lte_up != 1):
yield Result(state=State.CRIT, summary="LTE-Verbindung ist gestört")
else:
yield Result(state=State.OK, summary="LTE-Verbindung ist aufgebaut")
def discover_generic(section):
yield Service()
check_plugin_oneaccess_if_lte_up = CheckPlugin(
name = "oneaccess_if_lte_up",
sections = ['oneaccess_data'],
service_name = "Interface LTE",
discovery_function = discover_generic,
check_function = check_if_lte_up,
)
def parse_oneaccess_data(string_table):
section = {}
section["if_lte_up"] = string_table[0][0]
return section
snmp_section_oneaccess_data = SimpleSNMPSection(
name = "oneaccess_data",
detect = contains(".1.3.6.1.2.1.1.1.0", "OneOS-pCPE-ARM_pi1-6.14.2m2"), # sysDescr
fetch = SNMPTree(
base = '.1.3.6.1.2.1.2.2.1.8',
oids = [
'402657280' # if_lte_up
],
),
parse_function = parse_oneaccess_data,
)
I copied the py-file to local/lib/python3/cmk_addons/plugins/oneaccess/agent_based/oneaccess.py.
When manually executing
cmk --detect-plugins=oneaccess_if_lte_up --debug -vvv Host-to-monitor the test is succesful:
value store: loading from disk
Checkmk version 2.4.0p16
+ FETCHING DATA
Source: SourceInfo(hostname='Host-to-monitor', ipaddress='192.168.10.10', ident='snmp', fetcher_type=<FetcherType.SNMP: 7>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7f74e6e96540]
Read from cache: SNMPFileCache(path_template=/omd/sites/sitename/tmp/check_mk/data_source_cache/snmp/{mode}/Host-to-monitor, max_age=MaxAge(checking=0, discovery=90.0, inventory=90.0), simulation=False, use_only_cache=False, file_cache_mode=6)
Not using cache (Mode Mode.FORCE_SECTIONS)
oneaccess_data: Fetching data (SNMP walk cache cleared)
Executing BULKWALK (v3) of ".1.3.6.1.2.1.2.2.1.8.402657280" on Host-to-monitor
Executing SNMP _Mode.GET of .1.3.6.1.2.1.2.2.1.8.402657280 on Host-to-monitor
=> [<netsnmp.client.Varbind object at 0x7f74e72d37a0>] INTEGER
.1.3.6.1.2.1.2.2.1.8.402657280 => [b'1'] 'INTEGER'
Not using cache (Mode Mode.FORCE_SECTIONS)
[cpu_tracking] Stop [7f74e6e96540 - Snapshot(process=posix.times_result(user=0.029999999999999805, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.14000000059604645))]
[cpu_tracking] Start [7f74e78188f0]
+ PARSE FETCHER RESULTS
HostKey(hostname='Host-to-monitor', source_type=<SourceType.HOST: 1>) -> Add sections: ['oneaccess_data']
Received no piggyback data
Interface LTE LTE-Verbindung ist aufgebaut
[cpu_tracking] Stop [7f74e78188f0 - Snapshot(process=posix.times_result(user=0.020000000000000018, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.019999999552965164))]
value store: updating
Trying to acquire lock on /omd/sites/sitename/tmp/check_mk/counters/Host-to-monitor
Got lock on /omd/sites/sitename/tmp/check_mk/counters/Host-to-monitor
value store: already loaded
value store: writing to disk
Releasing lock on /omd/sites/sitename/tmp/check_mk/counters/Host-to-monitor
Released lock on /omd/sites/sitename/tmp/check_mk/counters/Host-to-monitor
[snmp] Success, execution time 0.2 sec | execution_time=0.160 user_time=0.050 system_time=0.000 children_user_time=0.000 children_system_time=0.000 cmk_time_snmp=0.110
When restarting (cmk -R) monitoring core, the service is visible in GUI and seems to work.
But after some time, the service changes to “Unimplemented check oneaccess_if_lte_up”. Does anybody know what I am doing wrong?
Best regards,
UT2019