Location of Agent Plugin with new API

Hi,

I’m trying to find out where to put agent plugins (not checks) according to the new API. I think with the new API all files of a plugin should go somewhere under /omd/sites//local/lib/python3/cmk_addons/plugins/, which is a good idea to be able to put them under version control with Git.

I’ve been looking through the documentation and the examples in the Checkmk Git repo, but I could not find anything yet.

Regards,
Sven

Yes the path should be /omd/sites/<SITENAME>/local/lib/python3/cmk_addons/plugins/

with subdir for

<plugin_name>/agent_based/  
<plugin_name>/graphing/  
<plugin_name>/rulesets/

Examples can be found here:

What you posted I already found in the documentation. But my question is about the agent plugins, the ones that will be used in the bakery and bundled with the agent packages.

As far as I know this one has to be placed here:
~/local/share/check_mk/agents/custom/<plugin-name>/lib/plugins/<plugin-name>

and if you want it asyncron run you can place it for example like this:
~/local/share/check_mk/agents/custom/<plugin-name>/lib/plugins/14400/<plugin-name>

Ah ok, that’s a bit disappointing. I know that folder, but I thought with the redesign of the plugin API the files that belong to one plugin live under the same common plugin folder. So I thought I ask about that in the forum. Sometimes the documentation is not yet fully adjusted. I find it a bit strange to have files of a plugin that belong together beeing spread all over the filesystem so that I cannot have them together in a Git repo.

Totally agree. But it should be possible to work with symlinks. This is only an example but should work.

Example git repo is located at:
/omd/sites/<SITE-NAME>/my-git-repo/

with directories

  • local/lib/python3/cmk_addons/plugins/<plugin_name>
  • local/share/check_mk/agents/custom/<plugin-name>/lib/plugins/

From here you can create symlinks e.g.

ln -s ~/local/lib/python3/cmk_addons/plugins/<plugin_name> ~/my-git-repo/local/lib/python3/cmk_addons/plugins/<plugin_name>
ln -s ~/local/share/check_mk/agents/custom/<plugin-name>/lib/plugins/  ~/my-git-repo/local/share/check_mk/agents/custom/<plugin-name>

Maybe someone else has a better/smother solution.

Sounds like a good solution, I will try that, thanks.

1 Like

With my Windows patch day plugin you see what is possible at the moment.
Also the bakery part is outside the new folder structure.

Hi,

this is still pretty confusing. I have created a structure:

local/share/check_mk/agents/custom/myplugin/lib/plugins/

and put a file in there. It does not show in list of unpackaged files. I then followed the documentation here:

Monitoring Linux - The new agent for Linux in detail

created local/share/check_mk/agents/custom/myplugin/bin/ and put a file into there, also does not show up in the list of unpackaged files.

The only location I could find so far to put an agent plugin is here:

~/local/share/check_mk/agents/linux/plugins/myscript.sh

This shows up in the list of unpackaged files as an agent.

I’m actually looking for the right location to put an updated version of this agent that comes with Checkmk:

./share/check_mk/agents/plugins/mk_jolokia.py

I guess it would maybe just go to ~/local/share/check_mk/agents/plugins/ and there is no directory with the plugin name required?

Remove the “linux” then it is correct. Only for Windows you need the “windows” subfolder.

Yes this is the right location.

1 Like

I’m still having some trouble, but making progress. I’m trying to make a modified version of the jolokia plugin that comes with Checkmk, because I need to be able to add some additional headers to the requests.

Modifying the agent plugin works fine. I copied the original to local/share/check_mk/agents/plugins which I have linked to a Git repo. It’s detected fine, and when I build agent packages, it includes my modified version.

{9264347E-D466-48E9-B8C9-42C0D33E59ED}

Next I would like to modify the rulespec form that defines what is to be put into the config file of the agent plugin. So I copied the original file:

/omd/versions/default/lib/python3/cmk/gui/cee/plugins/wato/agent_bakery/rulespecs/mk_jolokia.py

to:

~/local/lib/python3/cmk/gui/cee/plugins/wato/agent_bakery/rulespecs/mk_jolokia.py

I tried making cmk/ a link to my Git reposotory, but it does not seem to like that, the file does not show up in the unpackaged files list unter Extension Packages then.

I then removed the cmk link again and placed my modified file at the location without using any links, and now the file shows up under unpackaged files:

Is this the right location to put the rulespec file? It does not seem to be, my modification in that file does not show in the agent rules form, although I did an omd restart.

Could you give me hint where to place these files? I need to modify the agent plugin and the form, to give the agent plugin some addional config parameters and change it’s behaviour a little.

Regards,
Sven