nrpe problem on RedHat8 /tmp

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.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

nrpe problem on RedHat8 /tmp

Post 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
===================
Jonathan A.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: nrpe problem on RedHat8 /tmp

Post by Box293 »

Any chance you could upgrade NRPE to the v4 branch ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post 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?
===================
Jonathan A.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post 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... ?
===================
Jonathan A.
MrPippin
Posts: 13
Joined: Wed Mar 25, 2020 12:53 pm

Re: nrpe problem on RedHat8 /tmp

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: nrpe problem on RedHat8 /tmp

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post 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.
Attachments
tmpscript.txt
(474 Bytes) Downloaded 217 times
Last edited by jauerbach1234 on Thu Mar 26, 2020 9:22 am, edited 1 time in total.
===================
Jonathan A.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post 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.
===================
Jonathan A.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post 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
===================
Jonathan A.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: nrpe problem on RedHat8 /tmp

Post by Box293 »

Can you please provide the check_tmpfiles_count.sh script.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked