I dont know if that will work, there is a specific option inside nrpe.cfg for executing commands via sudo:
# COMMAND PREFIX # This option allows you to prefix all commands with a user-defined string. # A space is automatically added between the specified prefix string and the # command line from the command definition. # # *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! *** # Usage scenario: # Execute restricted commmands using sudo. For this to work, you need to add # the nagios user to your /etc/sudoers. An example entry for alllowing # execution of the plugins from might be: # # nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/ # # This lets the nagios user run all commands in that directory (and only them) # without asking for a password. If you do this, make sure you don't give # random users write access to that directory or its contents! # command_prefix=/usr/bin/sudo Also make sure you can run the command exactly like nrpe does as the user nrpe is running as. As for your bolded question, go chmod 644 check_load and try to run it, it will give you the same error. It just means that the script executed but didn't respond with recognized output. On 8/12/08, Jake Solid <[EMAIL PROTECTED]> wrote: > I did modified the nrpe.cfg to execute commands via sudo by adding the > following line: > > *command[check_smartmon]=/usr/bin/sudo > /usr/lib64/nagios/plugins/check_smartmon ata -d /dev/sda* > > *Why I'm able to invoke the following plugins from the nagios server using > check_nrpe but when invoking check_smartmon I get *NRPE: Unable to read > output*?* > > command[check_users]=/usr/lib64/nagios/plugins/check_users -w 8 -c 10 > command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c > 30,25,20 > command[check_disk1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p > /dev/mapper/VolGroup00-LogVol00 > command[check_disk2]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p > /dev/mapper/VolGroup00-LogVol01 > command[check_disk3]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p > /dev/mapper/VolGroup00-LogVol02 > command[check_disk4]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p > /dev/mapper/VolGroup01-LogVol00 > command[check_md]=/usr/lib64/nagios/plugins/check_swraid > command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 > -s Z > command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 200 -c > 300 > > > > On Tue, Aug 12, 2008 at 12:25 PM, <[EMAIL PROTECTED]> wrote: > >> executing check_nrpe via sudo will not accomplish what you want. You >> will need to either modify the nrpe.cfg to execute commands via sudo, >> or write a wrapper for check_smartmon. I am not familiar with that >> plugin, but you may also be able to edit it and prepend /path/to/sudo >> before it execs smartctl. >> >> >> >> On 8/12/08, Jake Solid <[EMAIL PROTECTED]> wrote: >> > I'm trying to use check_nrpe with check_smartmon but I'm getting NRPE: >> > Unable to read output at the Nagios Server. *All other check plugins >> > like >> > check_load and check_procs work fine. >> > * >> > *I'm running the following command from my nagios server to the remote >> host: >> > * >> > *./check_nrpe -H remotehost.domain.com -c check_smartmon* >> > >> > *and the out put is the following:* >> > *NRPE: Unable to read output* >> > >> > *This is what the remote host logs display:* >> > *Aug 12 11:16:13 *remotehost* xinetd[7151]: START: nrpe pid=7986 from= >> > 198.162.1.1 <- Nagios Server IP Address >> > Aug 12 11:16:13 *remotehost* nrpe[7986]: INFO: SSL/TLS initialized. All >> > network traffic will be encrypted. >> > Aug 12 11:16:13 *remotehost* xinetd[7151]: EXIT: nrpe status=0 pid=7986 >> > duration=0(sec)* >> > >> > >> > *When I use the check_smartmon directly in the remote machine as the >> > user >> > nagios and using sudo it works fine:* >> > [EMAIL PROTECTED] plugins]$ sudo >> /usr/lib64/nagios/plugins/check_smartmon >> > ata -d /dev/sda >> > OK: device is functional and stable (temperature: 33) >> > >> > *If I change the only_from line on /etc/xinetd.d/nrpe file to >> > 127.0.0.1and >> > I run the following from the remote host I get prompted by a password:* >> > [EMAIL PROTECTED] plugins]$ sudo /usr/lib64/nagios/plugins/check_nrpe >> -h >> > remotehost.domain.com.latpro.com -c check_smartmon >> > Password: >> > * >> > *The permissions on the device are the following:* >> > [EMAIL PROTECTED] plugins]$ ls -lah /dev/sda >> > brw-rw---- 1 root disk 8, 0 Jan 8 2008 /dev/sda* >> > >> > *The disk group also has nagios:* >> > disk:x:6:root,nagios >> > >> > >> > *And again the other plugins work fine when they are invoked from the >> Nagios >> > server. Like the following:* >> > [EMAIL PROTECTED] plugins]$ ./check_nrpe -H remotehost.domain.com -c >> > check_load >> > OK - load average: 2.14, 2.44, 2.72|load1=2.140;15.000;30.000;0; >> > load5=2.440;10.000;25.000;0; load15=2.720;5.000;20.000;0; >> > >> > *I added the following line on my remotehost to the /etc/sudoers:* >> > nagios ALL=(ALL) NOPASSWD: >> > >> /usr/sbin/smartctl,/usr/lib64/nagios/plugins/check_nrpe,/usr/lib64/nagios/plugins/check_smartmon >> > >> > I also try running the NRPE as adeamon and not with xinetd and I had the >> > same issue. >> > >> > Any inputs? >> > >> > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Nagios-users mailing list Nagios-users@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