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

Re: nrpe problem on RedHat8 /tmp

Post by MrPippin »

jauerbach1234 wrote:
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.
Thanks for supplying the script.

You don't have a #! specifier in the front of the script. I'd correct that, first.

That would assure that the script is run with the same shell regardless whether it's you running it or nagios.

Could be a globbing issue, based on what it's the script.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nrpe problem on RedHat8 /tmp

Post by scottwilkerson »

MrPippin wrote:Thanks for supplying the script.

You don't have a #! specifier in the front of the script. I'd correct that, first.

That would assure that the script is run with the same shell regardless whether it's you running it or nagios.

Could be a globbing issue, based on what it's the script.
Thanks @MrPippin
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: nrpe problem on RedHat8 /tmp

Post by danjoh »

It could also be this "feature" of RHEL/CENTOS/... that are using systemd.
If a daemon is started from systemd (like NRPE probably is) then each daemon get "their own" tmp.

Code: Select all

$ ls -pald /tmp/systemd-private-efe0909f6f6643228d757bba32e90eb9-*
drwx------ 3 root root 60 Feb 20 13:50 /tmp/systemd-private-efe0909f6f6643228d757bba32e90eb9-chronyd.service-W8HRcm/
drwx------ 3 root root 60 Mar 18 14:06 /tmp/systemd-private-efe0909f6f6643228d757bba32e90eb9-httpd.service-I0ggOW/
drwx------ 3 root root 60 Feb 20 13:50 /tmp/systemd-private-efe0909f6f6643228d757bba32e90eb9-mariadb.service-hXjTGM/
drwx------ 3 root root 60 Mar 27 13:44 /tmp/systemd-private-efe0909f6f6643228d757bba32e90eb9-systemd-timedated.service-Cv8v5M/
I think this is controlled with "PrivateTmp=" in the service file.

Regards,
--
D/\N
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post by jauerbach1234 »

MrPippin wrote: Thanks for supplying the script.

You don't have a #! specifier in the front of the script. I'd correct that, first.

That would assure that the script is run with the same shell regardless whether it's you running it or nagios.

Could be a globbing issue, based on what it's the script.
Sorry, I did not include the header info in the attached script because it contains non-public info. I assure you there is a#!/bin/bash on the first line.

If it is a globbing issue why does the exact same script work when checking for similarly named files in a differently named directory?
===================
Jonathan A.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post by jauerbach1234 »

danjoh wrote:It could also be this "feature" of RHEL/CENTOS/... that are using systemd.
If a daemon is started from systemd (like NRPE probably is) then each daemon get "their own" tmp.
I think this is controlled with "PrivateTmp=" in the service file.
Regards,
Thanks! This seems like a much more plausible cause versus nitpicking on a script that clearly works. I will check into this further. The only thing is that systemd was implemented in RH7 and I am not seeing the issue on RH7 systems...
===================
Jonathan A.
jauerbach1234
Posts: 9
Joined: Mon Mar 23, 2020 10:27 am

Re: nrpe problem on RedHat8 /tmp

Post by jauerbach1234 »

jauerbach1234 wrote:
danjoh wrote:It could also be this "feature" of RHEL/CENTOS/... that are using systemd.
If a daemon is started from systemd (like NRPE probably is) then each daemon get "their own" tmp.
I think this is controlled with "PrivateTmp=" in the service file.
Regards,
Thanks! This seems like a much more plausible cause versus nitpicking on a script that clearly works. I will check into this further. The only thing is that systemd was implemented in RH7 and I am not seeing the issue on RH7 systems...
This was exactly the cause of the problem. On the RH8 client, "PrivateTmp=" was set to true. Restarting the service after setting it to false, fixed it.

To answer my own questions about RH7 systemd, I am using an older version of NRPE that is not implementing that setting in the service file.

Thanks so much @danjoh!
===================
Jonathan A.
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: nrpe problem on RedHat8 /tmp

Post by danjoh »

You are welcome, glad I could help. :geek:

Have a nice Weekend!
--
D/\N
Locked