[Nagiosplug-help] sudo issue

Rudi Kramer rudi.kramer at gmail.com
Thu Jan 15 07:21:25 CET 2009


Hello,

I'm busy trying to run check_nfsmounts on a remote sever via
check_nrpe and sudo but I can't seem to get it working. The remote
server is running on redhat es 4 and NRPE v2.12.

I've setup sudo to work with the nagios user and if I login with the
nagios user and run the command via sudo it works fine.

[nagios at app1 ~]$ sudo /usr/local/nagios/libexec/check_nfsmounts
NFS OK: 2 mount points avg of 0.00139 secs, max 0.00147
secs.|maxtime=0.0014651;avgtime=0.0013856;mountpoints=2

This is what I get from the log file:

Dec 23 15:14:31 server123 sudo:   nagios : TTY=pts/3 ;
PWD=/home/nagios ; USER=root ;
COMMAND=/usr/local/nagios/libexec/check_nfsmounts

But when I try using check_nrpe it fails:

[nagios at app1 ~]/usr/local/groundwork/nagios/libexec/check_nrpe -H
127.0.0.1 -c check_nfs
NRPE: Unable to read output

Here is the output of /var/log/debug:

Jan 15 07:57:12 sabccmsapp1 nrpe[10616]: Host address is in allowed_hosts
Jan 15 07:57:12 sabccmsapp1 nrpe[10616]: Handling the connection...
Jan 15 07:57:12 sabccmsapp1 nrpe[10616]: Host is asking for command
'check_nfs' to be run...
Jan 15 07:57:12 sabccmsapp1 nrpe[10616]: Running command: sudo
/usr/local/nagios/libexec/check_nfsmount

Jan 15 07:57:12 sabccmsapp1 sudo(pam_unix)[10618]: authentication
failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=nagios

Jan 15 07:57:15 sabccmsapp1 nrpe[10616]: Command completed with return
code 1 and output:
Jan 15 07:57:15 sabccmsapp1 nrpe[10616]: Return Code: 1, Output: NRPE:
Unable to read output
Jan 15 07:57:15 sabccmsapp1 nrpe[10616]: Connection from 196.38.192.118 closed.

Here is the check command from my nrpe.cfg:

#Check Nfs
command[check_nfs]=sudo /usr/local/nagios/libexec/check_nfsmounts

Here is my sudoers file:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# User privilege specification
root    ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL
# Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
#Nagios Entry
nagios          ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/

My hunch is that something in pam is causing this issue but I have no
ida how to go about fixing it.

Any ideas?

Thanks
Rudi

P.S I did check for "require tty" in my /etc/sudoers file but it's not there.




More information about the Help mailing list