Missing Nagios plugins in CentOS 7

I set up a Nagios server on a CentOS 7 VM (Virtual Machine):

sudo yum install epel-release
sudo yum install nrpe
sudo yum install nagios

By default it sets up some basic checks for localhost. When I checked the Nagios site at http://127.0.0.1/nagios/, I found that even PING was critical:

(No output on stdout) stderr: execvp(/usr/lib64/nagios/plugins/check_ping, ...) failed. errno is 2: No such file or directory

I checked the contents of the plugins directory:

# ls /usr/lib64/nagios/plugins
eventhandlers negate urlize utils.sh

Sure enough, the usual suspects are not there. E.g.:

  • check_load
  • check_ping
  • check_disk
  • check_http
  • check_procs

Eventually I stumbled onto the following document, /usr/share/doc/nagios-plugins-2.0.3/README.Fedora:

Fedora users

Nagios plugins for Fedora have all been packaged separately. For
example, to isntall the check_http just install nagios-plugins-http.

All plugins are installed in the architecture dependent directory
/usr/lib{,64}/nagios/plugins/.

I installed some of the plugins following that convention:

sudo yum install nagios-plugins-load
sudo yum install nagios-plugins-ping
sudo yum install nagios-plugins-disk
sudo yum install nagios-plugins-http
sudo yum install nagios-plugins-procs

Now the the corresponding plugins exist in /usr/lib64/nagios/plugins, and Nagios reports OK for those checks on localhost.

3 thoughts on “Missing Nagios plugins in CentOS 7”

  1. Thanks to Noah Birnel for pointing out nagios-plugins-all! While I was looking at the various yum packages for Nagios, NRPE, and plugins I also noted this one:

    nagios-plugins

    What is nagios-plugins and how is it different than nagios-plugins-all?

    $ yum info nagios-plugins
    ...
    Summary     : Host/service/network monitoring program plugins for Nagios
    ...
    $ yum info nagios-plugins-all
    ...
    Summary     : Nagios Plugins - All plugins
    ...

    It’s still not really clear what the nagios-plugins package provides.

    Before any Nagios plugins are installed, the plugins directory already exists:

    /usr/lib64/nagios/plugins

    It contains just an empty directory, eventhandlers.

    After installing nagios-plugins (no dependent packages):

    $ ls -l
    total 100
    drwxr-xr-x. 2 root root     6 Nov 20  2017 eventhandlers
    -rwxr-xr-x. 1 root root 45328 Nov 21  2017 negate
    -rwxr-xr-x. 1 root root 45104 Nov 21  2017 urlize
    -rwxr-xr-x. 1 root root  2791 Nov 21  2017 utils.sh

    It looks like these are used by Nagios and plugins. urlize, for example, turns plugin output into a clickable link. I don’t understand why negate exists: given a Nagios plugin and options, it returns the opposite of what the plugin returns. CRITICAL instead of OK. Why does this even exist?

    After installing nagios-plugins-all (along with 103 dependent packages):

    $ ls | wc -l
    67

    The 3 files installed by nagios-plugins are also present, as it was one of the dependencies.

    Even installing just nagios-plugins-ping includes nagios-plugins as a dependency, so it looks like the files included in that package (negate, urlize, and utils.sh) are required by most (if not all) of the nagios-plugins-* packages.

    In general, I recommend avoiding installing any packages that aren’t strictly necessary. I would avoid installing nagios-plugins-all, but it is admittedly convenient.

Leave a Reply

Your email address will not be published. Required fields are marked *