NRPE: Unable to read output - using sudo

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pepe1234567890
Posts: 3
Joined: Mon Apr 09, 2018 1:32 am

NRPE: Unable to read output - using sudo

Post 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
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: NRPE: Unable to read output - using sudo

Post 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 '='.
--
D/\N
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output - using sudo

Post by scottwilkerson »

I think @danjoh may be on to something.

remember to restart nrpe after making the change
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
pepe1234567890
Posts: 3
Joined: Mon Apr 09, 2018 1:32 am

Re: NRPE: Unable to read output - using sudo

Post 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?
pepe1234567890
Posts: 3
Joined: Mon Apr 09, 2018 1:32 am

Re: NRPE: Unable to read output - using sudo

Post by pepe1234567890 »

Anybody?

please !!!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Unable to read output - using sudo

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked