Add external command check_file_content

Hi guys!

I’m using icinga (director) since a few years with integrated check commands.
now i want to add the check_file_content check which i found here:

i have no idea how to integrate this external command in icinga director.
i found some posts regarding copying the file to /usr/lib/nagios/plugins but this doesnt work. even after reboot i cant find the check in icinga director.

Can someone point me the right way to integrate this check command in icinga direector?

  • Director version (System - About):
  • Icinga Web 2 version and modules (System - About):
  • Icinga 2 version (icinga2 --version):
  • Operating System and version:
    Ubuntu 16.07.7

Hey Ben!

I have made a few scripts and tested it up to an icinga2 agent. Unfortunately, it’s not always recognized from the director.

Additionally, you have to create the command yourself. The Icinga Director, as far as I know, does not automatically scan the plugins folder and saves it in the director.
Try to create the command manually and use Runtime Macros to parse variables as arguments.

In your case try to do the following:
Under Icinga2 Director, add a new command with the fields as follows:
Command type: Plugin Check Command
Command Name: check_file_content

Depending on your infrastructure, choose the appropriate zone. If you don’t have any satelites, just leave it blank and let Director deal with it.
Place the plugin script in the plugins folder on your agents that needs to run it. Make sure the registered hosts are in fact registered as an agent.
Do the following in the agents terminal:
sudo chmod +x

Under the arguments tab, add the arguments one by one with desired values. Most important 2 things here is Argument name and Value. The Value input should be with the syntax of $custom_data_field_name_here$

Under the Icinga Director, go to the Define Data Fields menu and add the variables you have just made for the command. These fields you can either add to the command itself, or the service template where you will use said command. For better overview, add the fields in a category.

Most of this is really just by free hand, but surely it can be automated with an automation script in puppet or ansible. But given how often this will be done, it might not be beneficial for you.

One thing I’ve been struggling with whenever registering a new plugin, is the director can’t always find the file itself, for some reason, even after doing icinga2 daemon -C on the agent and the master, so I usually just say “screw it” and restart the entire server, if i can permit it.

Hope this helps :metal: