I am developing a special agent that will perform data collection through an API, and I would like to create a rule to configure it via WATO.
While reading the article on how to develop plugins for Checkmk, I understood how to develop them and even how to create a rule for metrics, but I couldn’t find anything related to creating rules for special agents.
During my research, I came across a tip to check how the Fritzbox agent works. I took a look, but I still have some questions:
How is this “link” established between the agent and the rule? Does the agent have a naming convention?
I think a detailed written part about special agents in the docs would be nice. Maybe @mschlenker already has it on his Todo list.
in the meantime, I think if you got the special agent working, you know enough to deduct the necessary parts from existing special agents.
The necessary files aren’t easy to find in integrated check_mk special agents, but when you take a look at the ones on exchange.checkmk.com that usually works well.
A pretty minimal special agent config is in Checkmk Exchange (not however, there is a minor bug - the file in checks/ needs to be named agent_<name_of_your_special_agent> for it to work in CRE, I fixed that in m365_service_health-1.1.0.mkp (5.4 KB)
But other special agents can also be used as reference i.e. the nutanix Checkmk Exchange or redfish special agents.
Basically you need two additional files:
local/share/check_mk/web/plugins/wato/<your_special_agent.py> -> the GUI definition file, helping users define a rule in the rules.mk file
local/share/check_mk/checks/agent_<your_special_agent> to take the parameters from the rules.mk and built a matching CLI call for your special agent.