3

System: Ubuntu Server 14.04.1

uname -a
Linux [...] 4.4.0-116-generic #140~14.04.1-Ubuntu SMP Fri Feb 16 09:25:20 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Involved Software: nagios (core Version 3.5.1), powershell (6.0.2)

Problem:

When a powershell-script is run (on the beforementioned server) by the nagios service (in the context of the user "nagios") the powershell-instance creates a directory in /tmp but never deletes it. This results in the filesystem running out of INodes after about 2.5 days. With ps -ef I can see that the following command is executed by nagios: /usr/bin/pwsh -noni -nop -nol -ep Unrestricted /usr/local/nagios/libexec/[script name].ps1 [command line parameters] (I replaced the concrete names and arguments for the script because they contain sensitive data).

See result of dir -Directory in Powershell

@See result of <code>dir -Directory</code> in Powershell

See Content of example temporary directory

@See Content of example temporary directory

I think the Directory-names are the host-instance-ids like in Get-Host in powershell.

Question:

What arguments do I need to supply to powershell so that it deletes the temporary directories on Exit? Or even better: What Arguments do I Need to supply to powershell so that it uses the nagios-home-directory /home/nagios for storing profile data?

EDIT: I since implemented a workaround via cron and a small script which deletes all folders in /tmp once an hour. Clearly this is no solution.

pa4080
  • 30,621

0 Answers0