NAGIOS NRPE issue

Luis Sanchez luis.sanchez.sanchez at gmail.com
Mon Apr 27 09:04:34 CEST 2009


Finally I managed to run the script with NRPE using root privilegies.


The script didn't work. I tried with one of the NRPE samples adding sudo to
the command definition:

command[check_users]=sudo /usr/lib/nagios/plugins/check_users -w 5 -c 10


I commented the command_prefix option and I commented require_tty in the
sudoers file

#Defaults    requiretty


I think this last option is needed If you're passing parameters to the
script.



Thanks,



2009/4/24 Luis Sanchez <luis.sanchez.sanchez at gmail.com>

> Hi,
>
> I'm trying to run a script in a remote machine using root privileges (this
> is just a simple sample, just some output to a file).
>
>
> I run this command from the nagios server machine:
>
> /usr/lib/nagios/plugins/check_nrpe -H 192.168.168.33 -p 5666 -c
> service_restart
>
>
> and I get this error message:
>
> NRPE: Unable to read output
>
>
> I have added nagios user to the sudoers list (all the privileges to avoid
> permission problems). The NRPE daemon is started and listening in the
> correct port.
>
> The NRPE log in the monitorized machine is (no reference to the error):
>
> Apr 24 15:06:49 outrun nrpe[26716]: INFO: SSL/TLS initialized. All network
> traffic will be encrypted.
> Apr 24 15:06:49 outrun nrpe[26717]: Starting up daemon
> Apr 24 15:06:49 outrun nrpe[26717]: Warning: Daemon is configured to accept
> command arguments from clients!
> Apr 24 15:06:49 outrun nrpe[26717]: Listening for connections on port 5666
> Apr 24 15:06:49 outrun nrpe[26717]: Allowing connections from:
> 192.168.168.20,127.0.0.1
>
>
> If I change the nrpe configuration and comment command_prefix option. It
> works.
>
>
> I'm using centos 5.2 in the monitorized machine and the monitoring machine.
> The NRPE version is 2.12 and nagios server version is  3.0.6
>
>
> This is just a test to check how to execute commands being root. In fact
> the real aim is use event handlers to autoheal the monitorized machine by
> restarting a service if it gets down.
>
> Any idea on how to solve the problem?
> Thank you very much for your help
>
> BTW hereunder you can find more configuration data.
>
>
> MONITORIZED REMOTE MACHINE /etc/sudoers
> -----------------------------------------------------
>
> nagios          ALL=(ALL) NOPASSWD: ALL
>
>
>
> MONITORIZED REMOTE MACHINE NRPE CONFIGURATION
> -------------------------------------------------------------------
> log_facility=daemon
> pid_file=/var/run/nrpe.pid
> server_port=5666
> nrpe_user=nagios
> nrpe_group=nagios
> allowed_hosts=192.168.168.20,127.0.0.1
>
> dont_blame_nrpe=1
> command_prefix=/usr/bin/sudo
> debug=1
> command_timeout=60
> connection_timeout=300
> command[service_restart]=/usr/lib/nagios/plugins/service_restart
>
>
> MONITORIZED REMOTE MACHINE SCRIPT IN
> /usr/lib/nagios/plugins/service_restart
> ------------------------------------------------------------------------
> #!/bin/sh
> #
> # Event handler script for restarting the web server on the local machine
> #
> # Note: This script will only restart the web server if the service is
> #       retried 3 times (in a "soft" state) or if the web service somehow
> #       manages to fall into a "hard" error state.
> #
>
> whoami >> /tmp/asd.txt
> echo -n "hola" >> /tmp/asd.txt
> exit 0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090427/b80d98e9/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
-------------- next part --------------
_______________________________________________
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