I am writing a custom plugin for check-mk-raw:2.2.0-latest, by using the dockerized version, and following the official guide.
Basically, I have two files:
The data collector, i.e. the agent plugin, which goes under /usr/lib/check_mk_agent/plugins
The data parser, i.e. the agent_based plugin, which goes under local/lib/check_mk/base/plugins/agent_based
It works just fine.
Now I like to create a mkp package, to be able to easily install and update the plugin from the development environment to production.
I have created a “package manifest” by running mkp template, and I like to fill its files section to include both the parser and the collector. But unfortunately:
{
"author": "Gizero <info@gizeroenergie.it>",
"description": "Agent Plugin and Checks for ResIoT Gateways",
"download_url": "https://bitbucket.org/gizeroenergie/checkmk-gw-resiot",
"files": {
"agent_based": ["my_plugin.py"],
"agents": [],
"checkman": ["my_plugin"],
"gui": [],
"lib": [],
"???": ["my_plugin"] //<-- this is the "collector", placed under /usr/lib/check_mk_agent/plugins
},
"name": "my_plugin",
"title": "My Plugin",
"version": "1.0.0",
"version.min_required": "2.2.0p7",
"version.packaged": "2.2.0p7",
"version.usable_until": "None"
}
What to place instead of ??? ?
My “collector” basically performs a REST API call to have the status of a list of devices, and the “parser” manipulates the results to prepare them for Checkmk.
I am not even sure this is actually the most correct way to create the plugin… but at least it seems to work…
Place your agent plugin in $OMD_ROOT/local/share/check_mk/agents/plugins and mkp should pick it up.
The entry for the files section in the manifest is this: 'agents': ['plugins/youragentplugin'],.
BTW: Creating agent packages is very easy with the web based GUI in the enterprise edition. You could install the CCE (cloud edition turning into the free edition) for your development site.
This does not cover the deployment of the agent plugin to the monitored host. It only makes it possible to include the plugin file in the MKP package.
How the plugin file will be deployed to the host depends on the checkmk edition. With the RAW edition you will have to do it by hand (or via Ansible, Puppet, etc).
With the Enterprise edition you can use the agent bakery and the agent updater to do it, but you would need an additional bakery plugin with an accompanying ruleset.
ah now that’s clear.
So basically, after installing the plugin, I have to copy the file from $OMD_ROOT/local/share/check_mk/agents/plugins to /usr/lib/check_mk_agent/plugins, and then the performed setup will work just fine.