Skip to content

January 3, 2009

6

Nagios nrpe and sudo: “NRPE: Unable to read output”

On CentOS 5 (and RedHat EL as well), you can encounter the following behaviour when configuring an nrpe plugin with sudo:

[andrea@feyd ~]$ /usr/lib/nagios/plugins/check_nrpe -H 1.2.3.4 -c check_md_raid
NRPE: Unable to read output


Given that check_md_raid is defined as follows, in nrpe.conf:

command[check_md_raid]=sudo /usr/local/bin/nagios_check_md_raid

And given (for completeness) its relative /etc/sudoers line as follows:

nagios ALL=(ALL) NOPASSWD:/usr/local/bin/nagios_check_md_raid

Then the problem is in the requiretty options in /etc/sudoers, enabled by default on CentOS. Simply comment it as follows:

#Defaults requiretty

After that the plugin should work as expected:

[andrea@feyd ~]$ /usr/lib/nagios/plugins/check_nrpe -H 1.2.3.4 -c check_md_raid
RAID OK: All arrays OK [1 array checked]

Read more from Linux, Unix
6 Comments Post a comment
  1. Hoang Ha Du
    Dec 3 2009

    Thanks you so much !

  2. Darko Topolko
    Dec 8 2009

    Thanks a bunch!

    I’ve spent last hour trying to figure out what I was doing wrong :)

    Best regards,

    Darko

  3. Steakudnerscore
    Jan 18 2010

    Can some one tell me why the check_md_raid plugin needs root access? Isn’t it a little over kill?

  4. Jan 19 2010

    It looks like there are some check md scripts that will work without root privileges (those using /proc/mdstat) and some requiring it (those using mdadm).

  5. lomiz
    Apr 30 2010

    Thank’s so much!
    That was usefull!

  6. adamaxeman
    Jul 5 2010

    Thank you sir, this problem has been driving me nuts!

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word