Orphaned Powershell Processes from NSClient++

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
optionstechnology
Posts: 234
Joined: Thu Nov 17, 2016 11:26 am

Orphaned Powershell Processes from NSClient++

Post 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 -
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Orphaned Powershell Processes from NSClient++

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked