This shows you the differences between two versions of the page.
| — |
nagios:sudo [2009/10/08 15:30] (current) admin created |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | Taken from [[http://www.cyberz.org/blog/2009/01/03/nagios-nrpe-and-sudo-nrpe-unable-to-read-output/]] | ||
| + | |||
| + | Nagios nrpe and sudo: “NRPE: Unable to read output” | ||
| + | Filed under: Unix — Tags: Linux, Nagios, Sudo, Unix — andrea @ 7:21 pm | ||
| + | |||
| + | 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 its relative /etc/sudoers line for completeness 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] | ||