Linux – Nagios NRPE on Ubuntu 12.04 “Unable to read output”

linuxnagiosubuntu-12.04

Right to the point.

NRPE.CFG Modifications:

Added Nagios Host to Allowed:

allowed_hosts=127.0.0.1,192.168.1.10

Removed # in front of command_prefix=/usr/bin/sudo

After that i have reloaded the service.

/etc/init.d/nagios-nrpe-server restart

I have also edited /etc/sudoers

# User privilege specification
root    ALL=(ALL:ALL) ALL
nagios  ALL=NOPASSWD: /usr/lib/nagios/plugins/

Running:

$ ./check_users -w 5 -c 10
USERS OK - 1 users currently logged in |users=1;5;10;0

Works and i get my results

Running:

su nagios -c "./check_users -c 2 -w 2"

Resolves in nothing.

From the Nagios host to the new remote system i can run:

check_nrpe -H 192.168.1.20

And i get NPRE v2.12 as result.

I have checked so to that Nagios is owner to the plugin folder but still no go.

Any tips would be helpful.

(and yes i have googled and read a 10-20 threads but still no go)

Best Answer

It seems to me that you don't have the "requiretty" line in your sudoers files, make sure you have the following line there:

Defaults:nagios !requiretty

It's meaning is that nagios user (only) is not required to have a tty to run a command which is why I suspect your command fails.

If you're not sure which user runs nagios you can check it in the configuration file which is usually located in /etc/nagios/nrpe.cfg.

If I had experienced this issue I'd want to first make sure that nagios user is able to successfully run the command and in order to do that I'd enable nagios user's ability to log into the machine by editing it's line in /etc/passwd from:

nagios:x:113:120::/var/lib/nagios:/bin/false

to:

nagios:x:113:120::/var/lib/nagios:/bin/bash

Then, I'd su - nagios to continue my troubleshooting and then, after solving the issue I'd change this line back to /bin/false.

Related Topic