Plugin development: were to put additional binaries

Hello,

I would like to write a full-featured agent-based CheckMk plugin. The documentation about this seems to be quite good. But I’m missing one thing:
I need an additional (home-brewn) binary for my agent plugin. The plugin itself will call the binary with the appropiate options. I would like to distribute the binary as part of the CheckMk plugin (i.e. as part of the mkp file). Is this possible? What would be the correct location of the binary within the agent file structure?

Thanks and Regards,
Carsten

Put the binary inside the site in “~/local/bin”, this should work.

Thanks, Andreas. It seems that I’ve started my plugin development attempts with a check that does not need the additional binary. So I could not yet try it out. Instead I’m encountering a more fundamental issue. But I will open a new question fro this.

Ok, I’ve tried it. Putting the file to “~/local/bin” doesn’t work. I can use the extension manager to add it to the mkp package but it won’t get delivered as part of the agent. The extension manager tags the file as “Binary”.
I’ve also tried to put it to “~/local/share/check_mk/agents/bin” because this would be next to the “plugins” directory that contains the actual agent plugin. In this case the extension manager tags the file as “Agents: bin/” which sounds somewhat better – but it doesn’t get installed either.

I suppose I need to reference the file in “~/local/share/check_mk/agents/bakery/.py”. I had to do this to get the actual plugin file deployed. Unfortunately I couldn’t find any documentation on this file – so I don’t know how to do this.

That you want to ship an extra binary with your agent was not clear from your first question. I thought that you need to binary on the server.
You have two options - custom bakery script that ships your agent plugin and additionally the binary. Pay attention to the right target directories or the second one is the “Custom files” option inside the agent bakery.

I’m sorry that my question wasn’t clear. I would prefer the binary to be part of the mkp file. So adding custom files in the bakery is only an emergency solution.
I’ve found some documentation on the bakery API in this file: /opt/omd/versions/default/lib/python3/cmk/base/cee/plugins/bakery/bakery_api/__init__.py
Maybe this helps…

mkp files have nothing to do with plugins shipped to the client systems.

We must do a break here - what is really wanted

  • should this binary deployed on the target system with the agent and some plugin scripts?

or

  • is the binary needed on the server to process some output from an agent?

To clarify - mkp files are only needed to make extensions “transportable” between CMK servers.

Hi Andreas,

I know that mkp files are merely meant to create transportable/installable CheckMk extensions. Only those parts are delivered to the agent that are specified in the bakery plugin. (Note: I did not know this when I originally asked my question – there is a second thread that greatly improved my understanding: How to write agent rules?) Nevertheless I consider mkp files the clean way to write CheckMk extensions. If I can deliver something as a self-contained mkp file it behaves just like any builtin check. If I would opt for agent custom files two steps in CheckMk were necessary to make my agent plugin work: (1) enable it and (2) specify the needed custom files. A full-featured extension (that can be delivered as mkp file) only needs the first step.

Coming to your question: I have an agent plugin that needs to call an additional binary that in turn also needs to be deployed to the target system.

I could solve this problem using the previously mentioned bakery API documentation. Independently also Jiuka tried it out and documented the solution in my other thread (same link as above)

Regards,
Carsten