Page 1 of 2

nrpe problem on RedHat8 /tmp

Posted: Mon Mar 23, 2020 10:53 am
by jauerbach1234
I am having a problem with NRPE reading /tmp on a Redhat 8 system.

I have a basic bash script that checks for particular files (by name) in /tmp and then warns if too many (done via ls piped to wc). 

The permissions on /tmp are : drwxrwxrwt ; I have tried setting them to : drwxrwxrwx 
SELinux is disabled and I removed any ACLs on /tmp

The script works locally when running via "sudo -u nrpe <script>" in that it produces the correct number of the target files in /tmp.

When running the script remotely from my Nagios server using CLI check_nrpe (as nagios), it runs but always shows 0 for the # the target files. This is the same result as what the Nagios monitor service shows. 

If I move the files to some other directory and modify the script accordingly, the remote check_nrpe command works correctly. 

So, I am baffled as to why it won't work on /tmp... which is meant to be world readable. Despite that, I have tried various "sudo" additions  for nrpe without any luck and as noted, the script works on other directories (without extra sudo privs). Also, the same /tmp check script works perfectly on RH6 and RH7 systems via check_nrpe.

Additionally, I had another nagios/nrpe check that was dependent on reading the contents of a file (world readable)  in /tmp that did not work either (on the same RH8 host). I found a work around for that check but this other /tmp check is not so easy to work around. Regardless, the problem with /tmp seems the same. 

Lastly, all other nagios/check_nrpe checks for this host are working correctly.

@nrpe-client:# nrpe -V
NRPE - Nagios Remote Plugin ExecutorVersion: 3.2.1
@nagios-server:# /usr/lib64/nagios/plugins/check_nrpe -V
NRPE Plugin for NagiosVersion: 3.2.1

Re: nrpe problem on RedHat8 /tmp

Posted: Mon Mar 23, 2020 5:16 pm
by Box293
Any chance you could upgrade NRPE to the v4 branch ?

Re: nrpe problem on RedHat8 /tmp

Posted: Wed Mar 25, 2020 10:09 am
by jauerbach1234
Box293 wrote:Any chance you could upgrade NRPE to the v4 branch ?
Thanks for the response.

Generally, I prefer released versions via package mgmt systems, but since this is a test system, I am not adverse to trying that. But, I would like to know what you think it will do to correct? Or would simply be a shot in the dark?

Re: nrpe problem on RedHat8 /tmp

Posted: Wed Mar 25, 2020 10:17 am
by jauerbach1234
Box293 wrote:Any chance you could upgrade NRPE to the v4 branch ?
Thanks for responding.

Generally, I prefer packages from package mgmt systems, but since this is a test system, I am not adverse to trying that. Curious as to what fixes (if any) would be applied in so doing? or simply a shot in the dark... ?

Re: nrpe problem on RedHat8 /tmp

Posted: Wed Mar 25, 2020 3:33 pm
by MrPippin
Can you supply more details of this plugin you've written?

Had you put in debug statements in the script logging to a debug file to see the flow of execution?

Re: nrpe problem on RedHat8 /tmp

Posted: Wed Mar 25, 2020 9:14 pm
by Box293
jauerbach1234 wrote:
Box293 wrote:Any chance you could upgrade NRPE to the v4 branch ?
Thanks for responding.

Generally, I prefer packages from package mgmt systems, but since this is a test system, I am not adverse to trying that. Curious as to what fixes (if any) would be applied in so doing? or simply a shot in the dark... ?
I'm thinking some TLS stuff may have been stricter and more secure. Also v4 may be updated for RHEL 8.

Re: nrpe problem on RedHat8 /tmp

Posted: Thu Mar 26, 2020 9:17 am
by jauerbach1234
MrPippin wrote:Can you supply more details of this plugin you've written?
see attached
MrPippin wrote:Had you put in debug statements in the script logging to a debug file to see the flow of execution?
yes, tried that. The script flows as expected. The exception/issue is when doing the "ls" on /tmp remotely, the files are not read (ie, the script leaves the file_count at 0).

Again, the script works perfectly when run locally or even remotely when run on another directory.

Re: nrpe problem on RedHat8 /tmp

Posted: Thu Mar 26, 2020 9:20 am
by jauerbach1234
Box293 wrote:I'm thinking some TLS stuff may have been stricter and more secure. Also v4 may be updated for RHEL 8.
Seems reasonable. I will try to get it setup. Thx.

Re: nrpe problem on RedHat8 /tmp

Posted: Thu Mar 26, 2020 12:07 pm
by jauerbach1234
Box293 wrote:Any chance you could upgrade NRPE to the v4 branch ?
gave it a go but no success...

@nrpe-client# date
Thu Mar 26 16:43:51 UTC 2020
@nrpe-client# /usr/local/nagios/bin/nrpe -V
NRPE - Nagios Remote Plugin Executor
Version: 4.0.2
@nrpe-client# grep check_tmp_files /etc/nagios/nrpe.cfg
command[check_tmp_files]=/usr/local/nagios/libexec/check_tmpfiles_count.sh
@nrpe-client# sudo -u nrpe /usr/local/nagios/libexec/check_tmpfiles_count.sh
WARNING: 102 /tmp/myfiles files

@nagios-server# sudo -u nagios /usr/lib64/nagios/plugins/check_nrpe -H nrpe-client
NRPE v4.0.2
@nagios-server# sudo -u nagios /usr/lib64/nagios/plugins/check_nrpe -H nrpe-client -c check_tmp_files
OK: 0 /tmp/myfiles files

Re: nrpe problem on RedHat8 /tmp

Posted: Thu Mar 26, 2020 4:25 pm
by Box293
Can you please provide the check_tmpfiles_count.sh script.