# How can I add external commands to the PlugIn path?

**URL:** <https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327>\
**Category:** Icinga 2\
**Created:** [January 28, 2020, 1:35pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327 "2020-01-28T13:35:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 28, 2020, 1:35pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/1 "2020-01-28T13:35:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevie-sy](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@stevie-sy](https://community.icinga.com/u/stevie-sy)\
**Post date:** [January 28, 2020, 1:45pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/2 "2020-01-28T13:45:51Z")

</div>

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;](https://labs.consol.de/nagios/check_logfiles/index.html;) inkcuding an installation instruction.

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [January 28, 2020, 1:55pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/3 "2020-01-28T13:55:40Z")

</div>

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](https://icinga.com/docs/icinga2/latest/doc/05-service-monitoring/#plugin-setup).

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.

```auto
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

```auto
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

---

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 29, 2020, 9:24am UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/4 "2020-01-29T09:24:34Z")

</div>

> [@dnsmichi](#):
>
> ./configure --libexecdir=$PLUGIN\_DIR --with-nagios-user=$ICINGA\_USER --with-nagios-group=$ICINGA\_GROUP

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

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [January 29, 2020, 9:47am UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/5 "2020-01-29T09:47:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 29, 2020, 11:42am UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/6 "2020-01-29T11:42:11Z")

</div>

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](https://github.com/lausser/check_logfiles) && cd check\_logfiles  
> autoreconf

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [January 29, 2020, 12:15pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/7 "2020-01-29T12:15:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevie-sy](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@stevie-sy](https://community.icinga.com/u/stevie-sy)\
**Post date:** [January 29, 2020, 12:30pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/8 "2020-01-29T12:30:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 29, 2020, 1:12pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/9 "2020-01-29T13:12:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 29, 2020, 1:33pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/10 "2020-01-29T13:33:15Z")

</div>

What the heck. Why I’m in

> root@3b20db2daf6a

?

No wonder it can’t find the path.

---

<div class="post-metadata">

**Author:** ![homerjay](https://community.icinga.com/user_avatar/community.icinga.com/homerjay/32/377_2.png) [@homerjay](https://community.icinga.com/u/homerjay)\
**Post date:** [January 29, 2020, 2:24pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/11 "2020-01-29T14:24:25Z")

</div>

This is within the docker container, started by

> [@dnsmichi](#):
>
> docker run -ti ubuntu:bionic bash

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](https://labs.consol.de/nagios/check_logfiles/index.html#installation) you can find the installation process.

---

<div class="post-metadata">

**Author:** ![bricasti](https://community.icinga.com/user_avatar/community.icinga.com/bricasti/32/1490_2.png) [@bricasti](https://community.icinga.com/u/bricasti)\
**Post date:** [January 29, 2020, 2:30pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/12 "2020-01-29T14:30:54Z")

</div>

> [@homerjay](#):
>
> You can copy the check\_logfiles plugin from the container to the plugin-directory of the …

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

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [January 29, 2020, 2:34pm UTC](https://community.icinga.com/t/how-can-i-add-external-commands-to-the-plugin-path/3327/13 "2020-01-29T14:34:17Z")

</div>

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

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

Cheers,  
Michael
