Check external hosts using NRPE

ReynierPM rperezm at uci.cu
Mon Nov 16 17:46:47 CET 2009


Hi every:
I'm trying to check some services in a remote host (Ubuntu Linux 9.04 
Server) using NRPE. I have the NRPE plugin installed on both machines: 
the nagios server and the remote host. I describe below what I've done 
until now:

Remote Host (machine to check)
1) Compile and install the nagios plugins and NRPE
2) Check NRPE connection:
~# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12
3) Install and cofigure xinetd service (/etc/xinetd.d/nrpe)
* 10.128.50.2 (is the Nagios Server IP)
service nrpe
{
         flags           = REUSE
         socket_type     = stream
         port            = 5666
         wait            = no
         user            = nagios
         group           = nagios
         server          = /usr/local/nagios/bin/nrpe
         server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
         log_on_failure  += USERID
         disable         = no
         only_from       = 127.0.0.1 10.128.50.2
}
4) Add the NRPE daemon to services file (/etc/services)
5) Check if NRPE daemon is running correctly
~# netstat -at | grep nrpe
tcp        0      0 *:nrpe                  *:*                   LISTEN
6) Allow NRPE on iptables
## NRPE Nagios Plugin
iptables -A INPUT -p tcp --dport 5666 -j ACCEPT
7) Configure all services at /usr/local/nagios/etc/nrpe.cfg
command[check_ping]=/usr/local/nagios/libexec/check_ping!100.0,20%!500.0,60%

After all this changes, off course, I restart all services (xinetd, 
iptables and so on)

Server (machine where Nagios is running)
1) Install the NRPE plugin
2) Check connection to remote host
~# /usr/local/nagios/libexec/check_nrpe -H 10.128.50.11
NRPE v2.12
3) Create command definitions (/usr/local/nagios/etc/commands.cfg)

#'nrpe' command definition
define command{
         command_name    check_nrpe
         command_line    $USERS1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
4) Create host and service definitions

Host Template:
--
define host{
         name                            linux-server
         use                             generic-host
         check_period                    24x7
         check_interval                  5
         retry_interval                  1
         max_check_attempts              10
         check_command                   check-host-alive
         notification_period             24x7
         notification_interval           30
         notification_options            d,u,r
         contact_groups                  admins
         register                        0
}

Define Host (bacula-server.cfg) (the server to check):
--
define host{
         use                     linux-server
         host_name               bacula-server
         alias                   bacula
         address                 10.128.50.11
}

Define Services:
--
define service{
         use                             generic-service
         host_name                       bacula-server
         service_description             PING
         check_command                   check_nrpe!check_ping
}

Just one for now for testing purpose.
5) Restart Nagios
~#/etc/init.d/nagios restart

After all this I'm getting, constantly, these errors:

[1258389533] Warning: Return code of 127 for check of service 'SAN Space 
SDB1' on host 'bacula-server' was out of bounds. Make sure the plugin 
you're trying to run actually exists.
[1258389583] Warning: Return code of 127 for check of service 'SSH' on 
host 'bacula-server' was out of bounds. Make sure the plugin you're 
trying to run actually exists.
[1258389633] Warning: Return code of 127 for check of service 'Swap 
Usage' on host 'bacula-server' was out of bounds. Make sure the plugin 
you're trying to run actually exists.
[1258389813] Warning: Return code of 127 for check of service 'Total 
Processes' on host 'bacula-server' was out of bounds. Make sure the 
plugin you're trying to run actually exists.
[1258389813] SERVICE NOTIFICATION: nagiosadmin;bacula-server;Total 
Processes;CRITICAL;notify-service-by-email;(Return code of 127 is out of 
bounds - plugin may be missing)

The funny part is if I run this command (from nagios server):

# ./check_nrpe -H 10.128.50.11 -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0

What I miss here? Where is the error?
Cheers and thanks in advance

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list