I’m trying to make a SpecialAgent plugin. The plugin configuration ruleset allows a list of URL endpoints to be defined, which will be processed further to generate multiple services for each endpoint.
Hence i am using SpecialAgent, instead of ActiveCheck, as i understand ActiveCheck will always generate 1 service per ActiveCheck.
In the API documentation for SpecialAgentConfig the following is stated:
One SpecialAgentConfig can result in multiple calls of the special agent
Since i have a list of URL endpoints in the ruleset, i need to call the special agent multiple times, once for each URL in the list.
How would i go about doing this? I’ve tried to generate multiple yield SpecialAgentCommand in the server_side_calls but only the last yield seems to be executed.
I know it is possible for the HTTPv2 active check, as this also uses a list of URL endpoints, but how can it be done for the special agent?
Same as for the agent_bi I would pass the resulting data structure with my list of items (URLs with attributes like extra Header, Authentication etc) via STDIN to the special agent like the agent_bi does.
./lib/python3/cmk/special_agents/agent_bi.py
The special agent then iterates over the list of items/URLs and collects the monitoring data.
If you then let the special agent output in the format like for the <<>> checks you even do not have to write your own checks, just the special agent is sufficent.
Special_agent based checks work in the following chain:
Special Agent Ruleset → Server Side Call → Special Agent → Agent Based Plugin
A server_side_call script gets the form data of a rule. It’s the server_side_call script where you define a SpecialAgentConfig object. Based on the functions you pass to the SpecialAgentConfig object, commands are generated which call the special_agent executable.