How can I add external commands to the PlugIn path?

Dashboard (Host):
execvpe(/usr/lib/nagios/plugins/check_logfiles) failed: No such file or directory

I took “check_logfiles” from the external commands. How do I get it into the Plug In path or how do I copy it there?

kind regards

Hi,
if you don’t find the command in the directory what you can find in the error message, you can find it here https://labs.consol.de/nagios/check_logfiles/index.html; inkcuding an installation instruction.

1 Like

Hi,

CheckCommands refer to a plugin script/binary which is then executed with the configured arguments. The plugin needs to be installed on every endpoint the command is executed. This varies from plugin to plugin, usually the setup is described in their README. The generic description was added to the docs.

Well, in this case it isn’t so obvious from the docs, so let’s do this step by step in a Docker container with Ubuntu Bionic. Note: I’m using Git-Master here with first generating the configure file with autoreconf. If you prefer a tarball, the configure/make steps are the same.

docker run -ti ubuntu:bionic bash

apt-get update && apt-get -y install git build-essential autoconf
cd
git clone https://github.com/lausser/check_logfiles && cd check_logfiles
autoreconf

# Debian, for other distributions set 'icinga'
ICINGA_USER=nagios
ICINGA_GROUP=nagios

# RHEL uses lib64
PLUGIN_DIR="/usr/lib/nagios/plugins"

./configure --libexecdir=$PLUGIN_DIR --with-nagios-user=$ICINGA_USER --with-nagios-group=$ICINGA_GROUP

make

make install

Results in

root@3af332b34f25:~/check_logfiles# /usr/lib/nagios/plugins/check_logfiles
Usage: check_logfiles [-t timeout] -f <configfile> [--searches=tag1,tag2,...]
       check_logfiles [-t timeout] --logfile=<logfile> --tag=<tag> --rotation=<rotation>
                      --criticalpattern=<regexp> --warningpattern=<regexp>

Cheers,
Michael

2 Likes

-bash: ./configure: No such file or directory

Keep in mind that we cannot see your screen. Which steps did you do before to receive this error at this step. How does the current directory tree look like? Please provide as much context as needed to understand the problem.

Cheers,
Michael

Sorry, my fault. I’ve done the steps you’ve mentioned before.

docker run -ti ubuntu:bionic bash

apt-get update && apt-get -y install git build-essential autoconf
cd
git clone https://github.com/lausser/check_logfiles && cd check_logfiles
autoreconf

And a directory tree from where you call ./configure ...? Like, ls -lahR.

I tried the example from @dnsmichi line by line on our test server. It worked here (CentOS7). Be sure you are in the correct directory and you’ve installed autoreconf!

Now it worked. I had a typo. check_logfiles is now in

/usr/lib/nagios/plugins

But in Icingaweb2 it is still shown:

Plugin-Ausgabe:

execvpe(/usr/lib/nagios/plugins/check_logfiles) failed: No such file or directory

How can I teach the new path Icinga?

What the heck. Why I’m in

root@3b20db2daf6a

?

No wonder it can’t find the path.

This is within the docker container, started by

The whole build-process happens in the container.

You can copy the check_logfiles plugin from the container to the plugin-directory of the machine which will execute the script.
Or you start the build-process again on the machine itself.

As already mentioned here you can find the installation process.

2 Likes

Oh, man, I could have thought of that myself. Thanks a lot!

Yep, that’s why I said that this is an example in Docker. Rationale for doing this - I’m on macOS here :wink:

You can of course run the commands on your native system being Ubuntu, that’s what I would recommend anyways.

Cheers,
Michael

1 Like