Page 2 of 2
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 6:38 am
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.
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 7:22 am
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
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 7:52 am
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,
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 9:34 am
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?
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 9:44 am
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...
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 10:06 am
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!
Re: nrpe problem on RedHat8 /tmp
Posted: Fri Mar 27, 2020 10:11 am
by danjoh
You are welcome, glad I could help.
Have a nice Weekend!