i guess i missunderstood something in General how Conditions work
My follow Up question now is, how can i get Check Values into my special Agent?
I have a “ListOfStrings” in my WATO Check Settings from a specific Check.
...
...
...
("subsystemchecks", ListOfStrings (title=_("Subsystem: Check the Following Services:"), allow_empty=True)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithoutItem(
check_group_name="licenses",
group=RulespecGroupCheckParametersOperatingSystem,
match_type="dict",
parameter_valuespec=_parameter_valuespec_licenses,
title=lambda: _("Levels for License Expiry Check"),
))
How can i get the params from the ListofStrings Configured here into my Special Agent, so i can tell my Agent wich Licenses the Agent should get from the System?
This is done with what I call “agent checks”.
You will have to create a file in the folder local/share/check_mk/checks that should be called agent_<something> where <something> identifies your agent.
There are numerous “agent checks” present that you may use as inspiration. You will find them named share/check_mk/checks/agent_*.
These files register the agent in the special_agent_info dict and parse a command line that should be called when executing the agent.
You have to make sure, the dict-key in special_agent_info matches the name you gave the agent in your parameter specification. For instance, if you registered the agent-spec as name="special_agents:luck_generator you will have to use luck_generator as key for special_agent_info: special_agent_info["luck_generator"] = agent_luck_generator_arguments
Template that I use with cmk 2.0
#!/usr/bin/env python3
from cmk.base.config import special_agent_info, SpecialAgentConfiguration
from cmk.base.check_api import passwordstore_get_cmdline
def agent_something_arguments(params, hostname, ipaddress):
checks = " ".join(params["checks"]) if "checks" in params else "all"
args = [
elem
for chunk in (("--username", params["username"]),
("--password",
passwordstore_get_cmdline("%s", params["password"])),
("--host", ipaddress), ("--checks", checks),
("--timeout", params.get("timeout", 10)))
for elem in chunk
]
return SpecialAgentConfiguration(args, None)
# Call cmk.utils.password_store.replace_passwords() in datasource program
special_agent_info['something'] = agent_something_arguments