NSClient++ Help (#1) - Handle Leak -NRPEListener (#115) - Message List

Handle Leak -NRPEListener

I'm using this program's NRPEListener module on four machines (Running Win2K3 and Windows XP). The nsclient++ program leaks a windows handle whenever a check is called from check_nrpe. I have a Window's Scheduled task set to reset the nsclient++ service every so often.

I'd just like to stop resetting the service, does anyone know how to fix this?

***** NSC.ini File Without Comments *****

[modules]

NRPEListener.dll

[Settings]

allowed_hosts=192.168.101.101/32

use_file=1

[NRPE]

bind_to_address=192.168.100.100

[NRPE Handlers]

command[nrpe_ok]="C:\Program Files\NSClient++\scripts\ok.bat"

*****************************************

************ ok.bat File ****************

@echo Good

@exit 0

*****************************************

I was watching the Handles Column for NSClient++.exe in ProcessExplorer? (www.sysinternals.com).

This leak happens with every .vbs script called as well.

Thx, -Ryan

  • Message #889

    I have also noticed this. We had a few servers that had increased to about 100k handlers. Looking at it via process explorer and looking specifically at the handles it appears that after I run 12 NRPE checks, 1 check is a compiled exe, another is a vbs script, the rest are getting metrics from perfmon. I see an increase of 6 open handles of type "EVENT". Saddly the event types do not have a name (it is blank). We are using the latest 3.5 build so it looks like this still exists.

    • Message #890

      Do you use any HP performance counters?

      // MickeM

      • Message #891

        Just want to make sure by HP you mean the hardware/software vendor HP and not something else, if that is the case then no. We are monitoring standard windows perfmon metrics. Our nsc.ini config is:

        [modules] FileLogger.dll CheckSystem.dll CheckDisk.dll NRPEListener.dll CheckEventLog.dll CheckHelpers.dll

        [Settings] allowed_hosts="EDITED" use_file=1

        [log] ;debug=1 file=opsview-agent.log

        [NSClient]

        [Check System] ;# CPU BUFFER SIZE ; Can be anything ranging from 1s (for 1 second) to 10w for 10 weeks. Notice that a larger buffer will waste memory ; so don't use a larger buffer then you need (ie. the longest check you do +1). ;CPUBufferSize=1h

        ;# CHECK RESOLUTION ; The resolution to check values (currently only CPU). ; The value is entered in 1/10:th of a second and the default is 10 (which means ones every second) ;CheckResolution?=10

        [NRPE] ;# NRPE PORT NUMBER ; This is the port the NRPEListener.dll will listen to. port=5666

        ;# COMMAND ARGUMENT PROCESSING ; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed. allow_arguments=1

        ;# COMMAND ALLOW NASTY META CHARS ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. allow_nasty_meta_chars=1

        ;# USE SSL SOCKET ; This option controls if SSL should be used on the socket. use_ssl=1

        [NRPE Handlers] ; The old plugins we'll deprecate check_disk=scripts\deprecated\diskspace_nrpe_nt.exe $ARG1$ check_cpuload=scripts\deprecated\cpuload_nrpe_nt.exe $ARG1$ check_memload=scripts\deprecated\memload_nrpe_nt.exe $ARG1$ win_service=scripts\deprecated\service_nrpe_nt.exe $ARG1$

        ; The new NSClient++ checks nsc_checkdrivesize=inject CheckDriveSize $ARG1$ nsc_checkfilesize=inject CheckFileSize $ARG1$ nsc_checkfile=inject CheckFile $ARG1$ nsc_checkeventlog=inject CheckEventLog $ARG1$ nsc_checkcpu=inject CheckCPU $ARG1$ nsc_checkuptime=inject CheckUpTime $ARG1$ nsc_checkservicestate=inject CheckServiceState $ARG1$ nsc_checkprocstate=inject CheckProcState $ARG1$ nsc_checkmem=inject CheckMem $ARG1$ nsc_checkcounter=inject CheckCounter $ARG1$ check_mem_phys=scripts\deprecated\check_hugemem.exe -t=physical $ARG1$ check_mem_page=scripts\deprecated\check_hugemem.exe -t=page $ARG1$ check_winversion=cscript /nologo "c:\Program Files\Opsview Agent\scripts\check_winversion.vbs" $ARG1$ check_multi=inject CheckMultiple $ARG1$

        Our Nagios check command config for my testing host is:

        check_nrpe -H $HOSTADDRESS$ -c nsc_checkCounter -a '"Counter:Perfmon System - AVG Disk Queue Length=\PhysicalDisk?(_Total)\Avg. Disk Queue Length" ShowAll MaxWarn=100000000 MaxCrit=100000000' -t 30

        check_nrpe -H $HOSTADDRESS$ -c check_cpuload -a '80 95' -t 30

        check_nrpe -H $HOSTADDRESS$ -c check_disk -a 'd: 90 95' -t 30

        check_nrpe -H $HOSTADDRESS$ -c check_memload -a '95 98' -t 30

        check_nrpe -H $HOSTADDRESS$ -c check_multi -a 'command=CheckCounter "Counter:Read=\LogicalDisk(_Total)\Avg. Disk Sec/Read" ShowAll MaxWarn=10000 MaxCrit=10000 command=CheckCounter "Counter:Write=\LogicalDisk(_Total)\Avg. Disk sec/Write" ShowAll MaxWarn=10000 MaxCrit=10000' -t 30

        check_nrpe -H $HOSTADDRESS$ -c nsc_checkCounter -a '"Counter:Perfmon System - Processor Queue Length=\System\Processor Queue Length" ShowAll MaxWarn=100000000 MaxCrit=100000000' -t 30

        check_nrpe -H $HOSTADDRESS$ -c nsc_checkCounter -a '"Counter:Perfmon System - Percent Usage of Pagefile on C=\Paging File(\??\C:\pagefile.sys)\% Usage" ShowAll MaxWarn=100000000 MaxCrit=100000000' -t 30

        check_nrpe -H $HOSTADDRESS$ -c nsc_CheckCounter -a '"Counter:Perfmon System - Percent Disk Read Time=\PhysicalDisk?(_Total)\% Disk Read Time" ShowAll MaxWarn=100000000 MaxCrit=100000000' -t 30

        check_nrpe -H $HOSTADDRESS$ -c nsc_CheckCounter -a '"Counter:Perfmon System - Percent Disk Write Time=\PhysicalDisk?(_Total)\% Disk Write Time" ShowAll MaxWarn=100000000 MaxCrit=100000000' -t 30

        check_nrpe -H $HOSTADDRESS$ -t 60 -c check_winversion -a '0.3.1.4'

        The check_winversion is a vbs script I wrote to allow us to auto-update all of the installed agents simply by changing the version number to the version that you want installed.

        • Message #892

          By HP I meant proprietary HP performance counters (which leaks memory) but it does not seem to be the case so I shall investigate then...

          WOuld it be possible to check "which" check increases the handle count? (ie try to run them "manualy" and see when the handles are leaked?)

          // MickeM

          • Message #924

            Any update on this?

          • Message #894

            After a bit of testing it appears to be that anytime a bat,vbs,exe (something external to nsclient++) it leaks handles. As the initial poster stated just doing the above will leak handles.