Powershell Script times out and leaves orphan


#1

I am running a powershell script to scrape log files - but sometimes the logfile is really big and the check times out

The problem is that it leaves an orphaned powershell process behind - which slowly build up until they kill the server

I get a list of these in the event 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?


#2

Incidentally the alert the checks get when this happens is this-

CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

Not the timeout that I would expect…


#3

Add this key to your ‘nsclient.ini’ config file:

; Undocumented key payload length = 1024

Restart nsclient service after you save the config file so when service restarts it re-reads the new config parameter into its running memory. Retest your check. Good luck! —Roman