Page 1 of 1

Orphaned Powershell Processes from NSClient++

Posted: Thu May 31, 2018 4:20 am
by optionstechnology
I am using NSClient 0.5.0.62

I run several powershell scripts that scan logfiles that sometimes take a long time to return - breaching the 60 second time limit

For some reason NSClient occasionally fails to properly terminate these powershell processes, eventually leading to them building up over time and eating all of the memory

There are also a number of errors in the nsclient log-

2018-05-22 16:03:19: error:c:\source\master\include\socket/connection.hpp:120: Socket was unexpectedly closed trying to send data (possibly check your timeout settings)
2018-05-22 22:07:08: error:c:\source\master\include\socket/connection.hpp:120: Socket was unexpectedly closed trying to send data (possibly check your timeout settings)
2018-05-22 23:09:31: error:c:\source\master\include\socket/connection.hpp:120: Socket was unexpectedly closed trying to send data (possibly check your timeout settings)
2018-05-23 02:06:52: error:c:\source\master\include\socket/connection.hpp:120: Socket was unexpectedly closed trying to send data (possibly check your timeout settings)

Is there a way I can do this where the powershell scripts dont get orphaned?

I use the following registry entry to fire off the command-

Code: Select all

cmd /c echo scripts\check_logfile_date.ps1  $ARGS$; exit $LastExitCode | powershell.exe -ExecutionPolicy bypass -command -

Re: Orphaned Powershell Processes from NSClient++

Posted: Thu May 31, 2018 1:53 pm
by scottwilkerson
It appears someone is also looking for an answer to this on the NSClient forum as well
https://forums.nsclient.org/t/powershel ... rphan/5221

There is some info in there FAQ section 4.2 which may shed some light
http://docs.nsclient.org/faq/

IMO NSClient should handle it properly but if the decided to make a FAQ about it that may be there fix