Error:
NRPE: Unable to read output
How to reproduce:$ /usr/local/nagios/libexec/check_nrpe -H 172.22.232.11 -c df.sh
NRPE: Unable to read output
Checks:1. Ensure that the command you are using,
df.sh
in this case, is declared in /usr/local/nagios/etc/nrpe.cfg
file.command[df.sh]=sudo /usr/local/nagios/libexec/df.sh
2. Ensure that the user nagios
can run command, as per configurations done in /etc/sudoers
file. If not, please add below line.nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/df.sh
3. Also make sure that requiretty
option is disabled in /etc/sudoers
file. If it is enabled, it prevents any user from running sudo
commands from non-TTY sessions. In other words, a non-root user must be using a TTY to execute a sudo
command. This option is enabled, by default, in CentOS, and can be disabled by commenting it out as shown below.#Defaults requiretty
Result:$ /usr/local/nagios/libexec/check_nrpe -H 172.22.232.11 -c df.sh
OK- (/)= 6%;(/dev/shm)= 0%;(/boot)= 34%;(/var1)= 43%;(/home)= 41%;(/usr1)= 27%;(/data1)= 17%; | (/)= 6%;(/dev/shm)= 0%;(/boot)= 34%;(/var1)= 43%;(/home)= 41%;(/usr1)= 27%;(/data1)= 17%;
Hope this helps.
Good document. Resolved the issue I was having with this error.
ReplyDelete