CMK version: 2.1.0p20
OS version: CentOS 7
Working on a custom SNMP based plugin and following the guidelines on the release 2.1 SNMP subsection of Writing your own check plug-ins
Attempting to use the example usage for detection in the following function (short code example for brevity):
file is located ~/local/lib/check_mk/base/plugins/agent_based
from .agent_based_api.v1 import (
contains,
register,
Metric,
Result,
SNMPTree,
Service,
State,
)
register.snmp_section(
name = "broadworks_as",
detect = all_of(
equals(".1.3.6.1.2.1.1.1.0", "Broadworks Application Server"),
contains(".1.3.6.1.4.1.6431.1.1.2.1", "Application Server")
),
parse_function = parse_broadworks,
fetch = [
SNMPTree(
base=".1.3.6.1.4.1.6431.1.2.7.1",
oids=[
"1.0", # BW-Execution::bwCallpNetworkOriginationAttempts.0
"2.0", # BW-Execution::bwCallpNetworkTerminationAttempts.0
"3.0", # BW-Execution::bwCallpNetworkTerminationsAnswered.0
]),
],
)
Error message:
NameError: name ‘all_of’ is not defined
Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)
Traceback (most recent call last):
File "/omd/sites/testportals/bin/cmk", line 79, in <module>
errors = config.load_all_agent_based_plugins(check_api.get_check_api_context)
File "/omd/sites/testportals/lib/python3/cmk/base/config.py", line 1520, in load_all_agent_based_plugins
errors = agent_based_register.load_all_plugins()
File "/omd/sites/testportals/lib/python3/cmk/base/api/agent_based/register/__init__.py", line 48, in load_all_plugins
raise exception
File "/omd/sites/testportals/lib/python3/cmk/utils/plugin_loader.py", line 48, in load_plugins_with_exceptions
importlib.import_module(full_name)
File "/omd/sites/testportals/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/omd/sites/testportals/local/lib/python3/cmk/base/plugins/agent_based/broadworks.py", line 41, in <module>
detect = all_of(
NameError: name 'all_of' is not defined
Just sanity checking in case I am missing something obvious.
Reducing detect to just a single ‘equals’ value also results in a ‘NameError: name ‘equals’ is not defined’.
Thank you for your time.
Sincerely,
Scotsie