I am getting the error (Return code of 255 is out of bounds) on the http://localhost/nagios
But when I run the command from the shell, it runs fine
If you're using NRPE and receiving a 'NRPE: Unable to read output' error it is because the NRPE daemon is not returning text data. The Nagios core depends on NRPE daemons to return a string that summarizes the results of the checks. For instance, for a check result that is returning a healthy status, it may look like the former whereas an unhealthy status would be displayed the the latter.
OK - load average: 1.56, 1.37, 1.29
CRITICAL - load average: 16.59, 19.41, 21.96
If NRPE were to return something like this:
FOO: bar
You're going to get a 'NRPE: Unable to read output' error because FOO is not one of Nagios's known result states. Run the remote NRPE command by running something like this (depending on your directories and checks):
libexec/check_nrpe -n -H localhost -c check_load
That should return OK, WARNING, CRITICAL, or UNKNOWN. Anything else will cause that error.