[SOLVED] Help to configure Linux Remote Host please

Hello everybody,

I have some trouble configuring a Linux remote host with my Nagios Server which is working properly.
I performed a research before posting but the answers I’ve found didn’t help me so much. So please help me if it is possible.

This is the configuration:

Nagios Server:
OS: Gentoo Linux x86_64
Kernel: 2.6.34-hardened-r6
Nagios: 3.2.3

Nagios Client:
OS: AsteriskNow (CentOS) x86_64
Kernel: 2.6.18-128.2.1.el5

The Nagios server sees the client up and running in the Map section but the Problems->Services section shows the following messages:

Current Load CRITICAL 05-18-2011 10:03:03 5d 13h 41m 11s 3/3 (Return code of 127 is out of bounds - plugin may be missing) Root Partition CRITICAL 05-18-2011 10:03:34 5d 13h 39m 59s 3/3 (Return code of 127 is out of bounds - plugin may be missing)

The Event Log section reports:

[05-18-2011 10:03:36] Warning: Return code of 127 for check of service 'Root Partition' on host 'centralino' was out of bounds. Make sure the plugin you're trying to run actually exists. [05-18-2011 10:03:06] Warning: Return code of 127 for check of service 'Current Load' on host 'centralino' was out of bounds. Make sure the plugin you're trying to run actually exists.

These are the two sections I added to the file /etc/nagios/objects/nrpe-command.cfg:

[code]define service {
use generic-service
host_name centralino
service_description Current Load
check_command check_nrpe!check_load
}

define service {
use generic-service
host_name centralino
service_description Root Partition
check_command check_nrpe!check_disk
}[/code]

Furthermore, before posting I’ve followed all of these tutorials:
[list]]Gentoo System Monitoring with Nagios/:m]
]Gentoo Wiki Archives - HOWTO_Install_Nagios/:m]
]Installing NRPE (Nagios Client) on CentOS 5/:m][/list:u]
And again:
[list]]Add Linux host to nagios server/:m]
]How To Monitor Remote Linux Host using Nagios 3.0/:m][/list:u]

The most effective guide was Installing NRPE (Nagios Client) on CentOS 5, but now I can’t go ahead.
Could you help me please?

Ciao!

How are you trying to run the checks on the remote host? nrpe? nsca? check_by_ssh?
Did you install the plugins on the remote host? can you run the plugins on the client itself and get results?

Ciao Luca! :wink:

I installed nrpe on the remote host following this guide in particular: Installing NRPE (Nagios Client) on CentOS 5.
Then, when I saw those warnings I uninstalled them and reinstalled using yum, but the results are the same.
Maybe I have to perform some check in the remote host, both as regard the configuration and the installed plugins.

Of course yes, but before making the new installation directly using yum, I was bumped in the problem also described in the guide mentioned above:

CHECK_NRPE: Error - Could not complete SSL handshake.

or

CHECK_NRPE: Error receiving data from daemon.

When I tried to perform the check_nrpe test from the Nagios server:

/usr/lib/nagios/plugins/check_nrpe -H remote_host_ip

the command returned me the NRPE version 2.12, but now it returns: “Connection refused by host”.

Maybe I’ve caused some other problem :frowning:

Thank you so much.

first i’d recommend you don’t use yum/aptitude or whetever rpm manager, they tend to put files in driectories known only to themselves… :slight_smile:
So starting from source is usually better.

I don’t have an nrpe install running but i will try it myself as soon as i have the time to set it up…
I seem to remember there was some official docs on NRPE but i can’t find them, they restyled the site and those docs seem to bemissing. did you try a search here on the forum? i think Jakkedup wrote somehting about it a while ago.

OK, so I am going to remove nrpe and the plugins I installed with yum and reinstall from sources as I did the first time.
As regard the official documentation, I found it a little bit dispersive and unfriendly.
Of course I’ve searched in the forum.

I will let you know as soon as I install the nrpe plugin again from sources. Thanks.

OK,
here again after installing the nrpe and nagios-plugins again from sources on the remote host.
Well, if I perform the following command on the remote host:

I get:

But if I perform this command from the server:

I get:

So I think this is good for the moment. Isn’t it?

As regard the error on the remote host, as this guide says, I can try to issue the following command:

which gives me the message:

Well, this is because my config files only allow one server to talk to it. But even if I put also the localhost IP address in the allow from clause, it says connection refused. Anyway, maybe this is less important, since it is possible to successfully perform the test from the Nagios server.

This is OK:

# netstat -ant|grep 5666 tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN

Now the remote host should be again at the initial conditions. I would like to know what should I check in order to solve the error in the first post.

as i said i don’t have nrpe so i can’t try it. are you sure the nrpe client can reach the plugins? are there any permission settings you need to apply to have the plugins executabel by nrpe?

Ok ok, don’t worry if you don’t have nrpe now.

Maybe I don’t know how to verify it. Do you mean to perform some command at server side in order to verify that?

I think the permission are all correctly set. Unless the guide I read is not complete, there shouldn’t be any problem.

i ask because as it looks from the error the nrpe client can’t reach/execute the plugins and returns that code 127…

code 127 usually appears if you haven’t installed the plugin you are trying to run… maybe on the clients message.log or syslog filr there’s something…

Maybe I still have some confusion in mind. When it says the plugin is not installed, it refers to the client or to the server? I suppose the client, since the two service mentioned above are properly working on the nagios server (i.e. Current Load and Root Partition). If it refers to the client (i.e. the remote host), I think the plugins are installed.
If I did understand correctly the plugins should be the following: check_load and check_disk.
Well, on the remote host (but also on the Nagios Server) I have both:

/usr/local/nagios/libexec/check_load /usr/local/nagios/libexec/check_disk
That’s why I’m confused.

that’s how i THINK it should be…

i suppose the nrpe configuraiton on the client side has some info about the plugins location…

By the way, also a friend of mine told me the nrpe daemon should be only at the remote host (even if I remember correctly!) :smiley:

Well the nrpe configuration on the client side consists in the following files:
[list]]/etc/xinetd.d/nrpe/:m]
]/usr/local/nagios/etc/nrpe.cfg/:m][/list:u]
And of course the /etc/services file which is configured as well.

My impression is that nrpe is working properly but doesn’t see the plugins. In this case I don’t know where to check.

EDIT: nrpe should know where check_load and check_disk are since there are these two lines in the /usr/local/nagios/etc/nrpe.cfg file:

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1

ok, check under which user the nrpe client runs and see if that user can execute the plugins…

Thank you Luca,

in the /etc/xinetd.d/nrpe file I have these two lines:

user = nagios group = nagios

And these two lines in the /usr/local/nagios/etc/nrpe.cfg file:

nrpe_user=nagios nrpe_group=nagios

ls -l /usr/local/nagios/libexec/ gives me (with respect to check_nrpe, check_disk and check_load):

-rwxrwxr-x 1 nagios nagios 66085 May 18 16:47 check_nrpe -rwxr-xr-x 1 nagios nagios 432905 May 18 16:49 check_disk -rwxr-xr-x 1 nagios nagios 146407 May 18 16:49 check_load

Hi!

Maybe I’ve found out where the problem is.
The path in /etc/nagios/objects/remote/nrpe-commands.cfg for check_nrpe (on the server side) was incorrect.
Now I set this one:
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
and the check_load works.

Now I only have the problem to have also the check_disk working.
Actually I’ve defined two services in the /etc/nagios/objects/remote/nrpe-services.cfg file:

[code]define service {
use generic-service
host_name centralino
service_description Current Load
check_command check_nrpe!check_load
}

define service {
use generic-service
host_name centralino
service_description Root Partition
check_command check_nrpe!check_disk
}[/code]
But only the check_load works. The Nagios web gui says:

Furthermore I defined another check (check_asterisk) but this is another issue that I will discuss later on.

EDIT: SOLVED! I had to change the Root Partition service as it follows:

define service { use generic-service host_name centralino service_description Root Partition check_command check_nrpe!check_hda1 }

Furthermore, on the remote host side, I had to modify the following line:

to

in the /usr/local/nagios/etc/nrpe.cfg file.

Now I’m able to monitor the Root Partition satus and the system workload too!

Thanks for the support.

Thanks for the detailed solution description!

Buona settimana!

Not at all!

You too!