Nagios3 nrpe and event handler


#1

Hi all,
I’ll try to explain my problem, I’d like nagios to rum my script in another host. And seems that the configuration is not 100% good as the event handler is not starting the script in the remote server.

my cfg on nagios:
define service{
use luxoft-generic-service
host_name centos
service_description HTTP-test2
check_command check-ssl-sen-timeout
max_check_attempts 4
event_handler check_tomcat!$SERVICESTATE$!$SERVICESTATETYPE$!$SERVICEATTEMPT$
notifications_enabled 0
}

I setup a eventhandlers.cfg file called from nagios.cfg that creates a command:

define command{
command_name check_tomcat
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_tomcat $ARG1$ $ARG2$ $ARG3$
}

In the remote server I have running nrpe
/etc/xinetd.d/nrpe

default: on

description: NRPE (Nagios Remote Plugin Executor)

service nrpe
{
flags = REUSE
socket_type = stream
port = x
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 x.x.x.x
}

allow remote commands and configured with dont_blame_nrpe=1:

And in nrpe.cfg I have the following command:
command[check_tomcat]=/usr/local/nagios/libexec/tomcat $ARG1$ $ARG2$ $ARG3$

Well that was the configuration, now the logs. When I shutdown the Tomcat service the Nagios server log writes the following:
nagios nagios3: SERVICE ALERT: centos;HTTP-test2;CRITICAL;SOFT;3;HTTP CRITICAL: HTTP/1.1 503 Service Temporarily Unavailable
nagios nagios3: SERVICE EVENT HANDLER: centos;HTTP-test2;(null);(null);(null);check_tomcat!$SERVICESTATE$!$SERVICESTATETYPE$!$SERVICEATTEMPT

What am I doing wrong?
please help…
Thank you,


#2

But if I use a usual script, without check of arguments (as it is made in the instruction to Nagios) the script will be started.