Page 1 of 1

NRPE: Unable to read output - using sudo

Posted: Mon Apr 09, 2018 2:39 am
by pepe1234567890
Hi,

I read several topic in this forum and search in google about my problem but no find the solution.

I need to run a command 'check_disk' in a folder (filesystem) like 'root' (command sudo) where the limit access "drwx------ postgres postgres" .

(Remote host) I edit de file sudo (visudo)
#NAGIOS
Defaults:nrpe !requiretty
nrpe ALL=(root) NOPASSWD:/usr/lib64/nagios/plugins/check_disk

(Remote Host) I run the command:
/usr/bin/sudo /usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /var/lib/pgsql/pg_tblspc ---> It is WORK !!!


In nrpe.cfg
command[check_disk_sdb2_1]=/usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /var/lib/pgsql/pg_tblspc
command[check_disk_sdb2_2]==/usr/bin/sudo /usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /var/lib/pgsql/pg_tblspc

command[check_disk_sdb1_1]=/usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /
command[check_disk_sdb1_2]==/usr/bin/sudo /usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /



I run command:
/usr/local/nagios/libexec/check_nrpe -H REMOTE_HOST check_disk_sdb2_1
DISK CRITICAL - /var/lib/pgsql/pg_tblspc is not accessible: Permission denied --> It is OK. It is running like no root

/usr/local/nagios/libexec/check_nrpe -H REMOTE_HOST check_disk_sdb2_2
NRPE: Unable to read output --> NO WORK, WHY? :x

/usr/local/nagios/libexec/check_nrpe -H REMOTE_HOST -c check_disk_sdb1_1
DISK OK - free space: / 195423 MB (83.60% inode=100%);| /=38333MB;233676;233666;0;233756 ---> It is OK.

/usr/local/nagios/libexec/check_nrpe -H REMOTE_HOST -c check_disk_sdb1
NRPE: Unable to read output --> NO WORK, WHY? :x :x :x :x




I try to use new my script file, but the result is the same.


I don't know what is happend ???? Why is the message "NRPE: Unable to read output " where i running some command ike sudo ?


The host is a both Centos 7 ( Kernel: Linux 3.10.0-693.17.1.el7.x86_64)
NRPE - Version: 3.2.0
Nagios Core 4.1.1

Re: NRPE: Unable to read output - using sudo

Posted: Mon Apr 09, 2018 9:31 am
by danjoh
Do you really have '==' in your nrpe.cfg file or is it a typo?
If you have '==' try changing it to a single '='.

Re: NRPE: Unable to read output - using sudo

Posted: Mon Apr 09, 2018 12:59 pm
by scottwilkerson
I think @danjoh may be on to something.

remember to restart nrpe after making the change

Re: NRPE: Unable to read output - using sudo

Posted: Tue May 22, 2018 2:49 am
by pepe1234567890
Sorry, I write '==' but in the file rnpe.cfg it is a '='

I rest the service : systemctl restart nrpe.service

But It is no work. When i run a command (Nagios Server) "/usr/local/nagios/libexec/check_nrpe -H vs-sigm-bd-pre -c check_disk_sdb1" the message is: "NRPE: Unable to read output"


I don't know it !!!??

I check that
(remote server) su nagios
(remote server) [nagios] /usr/lib64/nagios/plugins/check_disk -w 80 -c 90 -p /var/lib/pgsql/pg_tblspc --> IT IS WORK

Any idea?

Re: NRPE: Unable to read output - using sudo

Posted: Tue May 22, 2018 4:37 am
by pepe1234567890
Anybody?

please !!!

Re: NRPE: Unable to read output - using sudo

Posted: Tue May 22, 2018 4:20 pm
by scottwilkerson
in visudo you need something like this (assuming NRPE daemon is running under the user "nrpe")

Code: Select all

Defaults:nrpe !requiretty
nrpe ALL=NOPASSWD: /usr/lib64/nagios/plugins/check_disk
NOTE this is different that what you previously shared