forums.meulie.net

Nagios Web Errors

ok, I’ve just changed the "check_host_alive in the minimal.cfg file, reloaded Nagios and restarted apache, still no joy. Still getting the same error messages.

“127 out of bounds, plugins may be missing”
“no output”

When I look for the “check_host_alive” in my plugins directory, it’s not there. That could be a problem.

Why is that plugin not there but check_ping is?

ok according to the error messages I’m getting, here are the four possibilities according to the Nagios FAQ documentation:

First here is the error message:
“Return code 127 out of bounds - plugin may be missing”

Here is the 4 possibilities:

  1. The plugin you’re using to perform the host or service check is not returning the proper return code when it exits.

  2. The path to the plugin is invalid (i.e. the binary or script does not exist). This is most likely the case if you get errors about a return code of 127 being out of bounds. If this is the error you’re getting, check your command definitions and make sure the path to all executables is correct (and that they’re actually installed on your system).

  3. The plugin is not executable. This is most likely the case if you get errors about a return code of 126 being out of bounds. If this is the error you’re getting, make sure you’ve set the plugin to be executable (using chmod +:evil:

  4. The plugins are not finding libraries they were linked against at compile time. Sean Berry noted that on Solaris 8 this results in plugins returning an exit code of 137. The fix for this is to set the LD_LIBRARY_PATH for the nagios account to include the paths to the necessary libraries (i.e. /usr/local/lib).

So after reviewing these, again, I see that 3 and 4 do not apply to me and here is how I know this . .

Because #3 states that the plugin is not executable and gives a return code error of 126.

I can execute the plugin because I can run it from the command line and the error code that I get is not 126, it’s 127.

And #4 returns an exit code of 137, again, my error code is that of 127 out of bounds. A different error.

However, the other two possibilities #1 and #2 I’m not sure about.

#1 states that the plugin is not returning the proper return code. How do I know what the proper return code is and how do I check that?

#2 states that if you are getting a 127 error code (which I am), then most likely it’s due to the incorrect path to the plugins that I’m trying to use. It tells me to check the command definitions (don’t know why, I know it works from the command line) and make sure the path to the executables are correct. (thought I did that also when making the change to the resource.cfg file)

Anyway, that is what I’ve narrowed this down to. If anyone can further advise, I would greatly appreciate it. Thanks !!!

[quote=“tekhed”]
When I look for the “check_host_alive” in my plugins directory, it’s not there. That could be a problem.

Why is that plugin not there but check_ping is? [/quote]

check-host-alive is the command name, it could be called “hey-am-i-alive” or whatever. The commands are defined in the checkcommands.cfg file.

My suggestion, is to remove the RPM install of nagios that you are using, and perform a source install.

The reason I state that, is due to you NOT have your plugins installed in the /usr/local/nagios/libexec directory.

Now if you have installed from source, then install your plugins correctly per the plugins documentation, and not in some other directory.

I really don’t want to uninstall and re-install from source at this moment without making sure it’s not something else that I’m just missing. As you can see, it’s very possible that I’m missing something. I mean, I’ve read the docs, but there is so much to Nagios that it’s easy to get confused especially as a Nagios beginner.

My question is, if the plugins have to be installed in that /libexec diretory, couldn’t I just move them there?

And, I followed the install docs step-by-step from the nagios site. So, why would there be a problem with the installation just because the plugins are in a different directory? And wouldn’t changing the resource.cfg file fix the “path to plugins” problem?

I don’t know, I’m a newbie at Nagios so anymore helpful information will be greatly appreciated. If I still don’t get anywhere by next week, I will most likely do the re-install of Nagios. Please advise. : )

When nagios is compiled, and yes, RPM packages are compiled, it is done so from the switches available.
./configure --help

one of those switches is this:
–libexecdir=DIR program executables in DIR [EPREFIX/libexec]

So if your RPM compiled nagios binary to look for the libexec dir in
/usr/timbucktoo/somelibexec directory, then that is where you have to install your plugins.
So you tell us how the nagios binary was copiled and we could tell you where the plugins should be. If you can’t, then remove the rpm and install from source. At least that way, if you install per the docs, the plugins will be located where most everyone else has them, in /usr/local/nagios/libexec

ok well that makes perfect sense. The problem is that I didn’t give any arguments when compiling Nagios. I just created the /usr/local/nagios directory as advised, then installed there without issuing any optional switches at compile time.

Basically I followed the steps in the docs below without issuing any extra switches at the time of install.

Become Root

You can download the latest version of Nagios from nagios.org/download.

Unpacking The Distribution

tar xzf nagios-version.tar.gz

When you have finished executing these commands, you should find a nagios-version directory that has been created in your current directory. Inside that directory you will find all the files that compromise the core Nagios distribution.

Create Nagios User/Group

You’re probably going to want to run Nagios under a normal user account, so add a new user (and group) to your system with the following command (this will vary depending on what OS you’re running):

adduser nagios

Create Installation Directory

Create the base directory where you would like to install Nagios as follows…

mkdir /usr/local/nagios

Change the owner of the base installtion directory to be the Nagios user and group you added earlier as follows:

chown nagios.nagios /usr/local/nagios

Identify Web Server User

You’re probably going to want to issue external commands (like acknowledgements and scheduled downtime) from the web interface. To do so, you need to identify the user your web server runs as (typically apache, although this may differ on your system). This setting is found in your web server configuration file. The following command can be used to quickly determine what user Apache is running as (paths may differ on your system):

grep “^User” /etc/httpd/conf/httpd.conf

Add Command File Group

Next we’re going to create a new group whose members include the user your web server is running as and the user Nagios is running as. Let’s say we call this new group ‘nagcmd’ (you can name it differently if you wish). On RedHat Linux you can use the following command to add a new group (other systems may differ):

/usr/sbin/groupadd nagcmd

Next, add the users that your web server and Nagios run as to the newly created group with the following commands (I’ll assume apache and nagios are the respective users):

/usr/sbin/usermod -G nagcmd apache
/usr/sbin/usermod -G nagcmd nagios

Run the Configure Script

Run the configure script to initialize variables and create a Makefile as follows…(the last two options: --with-command-xxx are optional, but needed if you want to issue external commands)

./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup

* Replace prefix with the installation directory that you created in the step above (default is /usr/local/nagios)
* Replace cgiurl with the actual url you will be using to access the CGIs (default is /nagios/cgi-bin). Do NOT append a slash at the end of the url.
* Replace htmurl with the actual url you will be using to access the HTML for the main interface and documentation (default is /nagios/)
* Replace someuser with the name of a user on your system that will be used for setting permissions on the installed files (default is nagios)
* Replace somegroup with the name of a group on your system that will be used for setting permissions on the installed files (default is nagios)
* Replace cmdgroup with the name of the group running the web server (default is nagios) 

Compile Binaries

Compile Nagios and the CGIs with the following command:

make all

Installing The Binaries And HTML Files

Install the binaries and HTML files (documentation and main web page) with the following command:

make install

Installing An Init Script

If you wish, you can also install the sample init script to /etc/rc.d/init.d/nagios with the following command:

make install-init

You may have to edit the init script to make sense with your particular OS and Nagios installation by editing paths, etc.

Directory Structure And File Locations

Change to the root of your Nagios installation directory with the following command…

cd /usr/local/nagios

You should see five different subdirectories. A brief description of what each directory contains is given in the table below.

So you compiled nagios. Then nagios is expecting the plugins to be in /usr/local/nagios/libexec.

Please move them there and give them the correct permissions.
How you got the plugins where you did, I don’t know.

In my earlier posts I described that I don’t have that directory. ( /usr/local/nagios/libexec )

The only /libexec dirs that I have are :
/usr/libexec
/usr/local/libexec

And , the plugins are currently in:
/usr/lib/nagios/plugins

So , does this mean that I have to create the
/usr/local/nagios/libexec directory and then move the plugins there?

Thanks again for your assistance. : )

Then you didn’t install the plugins per the README file that comes with the plugins.
Please read that file and install per that file.

The important part you missed was:

  1. Run the configure script to initialize variables and create a Makefile, etc.

     ./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-cgiurl=SOMEURL
    

    a) Replace BASEDIRECTORY with the path of the directory under which Nagios
    is installed (default is ‘/usr/local/nagios’)
    b) Replace SOMEUSER with the name of a user on your system that will be
    assigned permissions to the installed plugins (default is ‘nagios’)
    c) Replace SOMEGRP with the name of a group on your system that will be
    assigned permissions to the installed plugins (default is ‘nagios’)
    d) Replace CGIURL with the path used to access the Nagios CGIs with
    a web browser (default is ‘/nagios/cgi-bin’)

  2. Compile the plugins with the following command:

     make
    
  3. Install the compiled plugins and plugin scripts with the following command:

     make install
    

    The installation procedure will attempt to place the plugins in a
    ’libexec/’ subdirectory in the base directory you specified with
    the --prefix argument to the configure script.

  4. Verify that your host configuration file (hosts.cfg) for Nagios contains
    the correct paths to the new plugins.

Now, how you installed the plugins to the directory that you did, I don’t know.

well you were right, I didn’t read through that README file. What I just tried was to create that /libexec directory which is where nagios expects the plugins, then I moved those scripts into that directory and reloaded Nagios.

IT WORKED !!! Now I am getting the proper display of the machines that I am monitoring.

THANKS TO ALL THAT HELPED !!! It’s GREATLY APPRECIATED !!! : )

This is a good example of the importance of the README files, the INSTALL files, and alike when you are installing in linux. The usual linux stuff is followed in almost every case:
./configure
make
make install
But sometimes it’s helpful to read the docs and find out exactly what is going on, i.e. where it is going to install the stuff, etc.

I know the above sounds like a lecture, but lately on this forum, there could have been a 50% reduction of troubles if the installers would simply read the docs supplied with nsca, nrpe, plugins, nagios, etc…

Honestly, I am not triing to degrade you or anything, since you are the only person to ever admit thus far, that you didn’t read the doc for that app you are attempting to work on. It takes a person with alot of self esteem to be able to do that and not feel bad about it.

But it does serve to show the importance of being honest and to follow instructions.