• Sponsorship

  • Configuration

    Configuration is fairly simple and straight forward. Open the configuration file in notepad (or you favorite editor) "notepad <installation path>\NSC.ini" and edit it accordingly. A longer description of the Configuration file is included in the following page.

    The file has sections (denoted with section name in brackets) and key/value pairs (denoted by key=value). Thus it has the same syntax as pretty much any other INI file in windows.

    The sections are described in short below. The default configuration file has a lot of examples and comments so make sure you change this before you use NSClient++ as some of the examples might be potential security issues.

    The configuration can also be stored in the system registry (HKLM\Software\NSClient++) there is currently no UI to configure this so the simplest way is to maintain the configuration in the INI file and "Migrate that" to the registry. This is can be done via the [RemoteConfiguration] module but in short:

    NSClient++ -noboot RemoteConfiguration ini2reg
    

    A sample configuration file is included in the download but can also be found here trunk/NSC.dist

    Modules

    This is a list of modules to load at startup. All the modules included in this list has to be NSClient++ modules and located in the modules subdirectory. This is in effect the list of plug-ins that will be available as the service is running. For information on the various plug-ins check the Modules section in the navigation box.

    A good idea here is to disable all modules you don’t actually use for two reasons. One less code equals less potential security holes and two less modules means less resource drain.

    Settings

    This section has generic options for how NSClient++will work, some of these settings (such as allowed_hosts) is inherited in sections below so it is probably a better idea to set them here in the "global" section.

    The options you have available here are

    OptionDefault valueDescription
    obfuscated_password...An obfuscated version of password. For more details refer to the password option below. To create the obfuscated Password use: "NSClient++.exe /encrypt"
    password...The password used by various (presently only NSClient) daemons. If no password is set everyone will be able to use this service remotely.
    allowed_hosts127.0.0.1A list (comma separated) with hosts that are allowed to connect and query data. If this is empty all hosts will be allowed to query data. BEWARE: NSClient++ will not resolve the IP address of DNS entries if the service is set to startup automatically. Use an IP address instead.
    use_file0Has to be set to 1 if you want the file to be read (if set to 0, and the use_reg is set to 1 the registry will be used instead)

    Advanced options:

    OptionDefault valueDescription
    master_key...The secret "key" used when (de)obfuscating passwords.
    cache_allowed_hosts1Used to cache looked up hosts if you check dynamic/changing hosts set this to 0.

    Log

    This section has options for how logging is performed. First off notice that for logging to make sense you need to enable the “FileLogger.dll” module that logs all log data to a text file in the same directory as the NSClient++ binary if you don’t enable any logging module nothing will be logged.

    The options you have available here are

    OptionDefault valueDescription
    debug0A Boolean value that toggles if debug information should be logged or not. This can be either 1 or 0.
    filensclient.logThe file to write log data to. If no directory is used this is relative to the NSClient++ binary.
    date_mask%Y-%m-%d %H:%M:%SThe date format used when logging to a file

    NSClient

    This is the NSClient module configuration options.

    OptionDefault valueDescription
    port12489The port to listen to
    obfuscated_password An obfuscated version of password. For more details refer to the password option below.
    password The password that incoming client needs to authorize themselves by. This option will replace the one found under Settings for NSClient. If this is blank the option found under Settings will be used. If both are blank everyone will be granted access.
    allowed_hosts A list (coma separated) with hosts that are allowed to poll information from NSClient++. This will replace the one found under Setting for NSClient if present. If not present the same option found under Settings will be used. If both are blank all hosts will be allowed to access the system. BEWARE: NSClient++ will not resolve the IP address of DNS entries if the service is set to startup automatically. Use an IP address instead or set cache_allowed_hosts=0 see above.
    bind_to_address The address to bind to when listening to sockets, useful if you have more than one NIC/IP address and want the agent to answer on a specific one.
    socket_timeout30The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will bail out. and discard the connection.
    versionautoThe version number to return for the CLIENTVERSION check (useful to "simulate" an old/different version of the client, auto will be generated from the compiled version string inside NSClient++

    Advanced options:

    OptionDefault valueDescription
    socket_back_log Number of sockets to queue before starting to refuse new incoming connections. This can be used to tweak the amount of simultaneous sockets that the server accepts. This is an advanced option and should not be used.

    NRPE

    This is configuration for the NRPE module that controls how the NRPE listener operates.

    OptionDefault valueDescription
    port5666The port to listen to
    allowed_hosts A list (coma separated) with hosts that are allowed to poll information from NRPE. This will replace the one found under Setting for NRPE if present. If not present the same option found under Settings will be used. If both are blank all hosts will be allowed to access the system
    use_ssl1Boolean value to toggle SSL encryption on the socket connection
    bind_to_address The address to bind to when listening to sockets.
    command_timeout60The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
    allow_arguments0A Boolean flag to determine if arguments are accepted on the incoming socket. If arguments are not accepted you can still use external commands that need arguments but you have to define them in the NRPE handlers below. This is similar to the NRPE "dont_blame_nrpe" option.
    allow_nasty_meta_chars0Allow NRPE execution to have “nasty” meta characters that might affect execution of external commands (things like > “ etc).
    socket_timeout30The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will bail out. and discard the connection.
    script_dir Load all scripts in a directory and use them as commands. Probably dangerous but usefull if you have loads of scripts :)

    Advanced options:

    OptionDefault valueDescription
    performance_data1Send performance data back to nagios (set this to 0 to remove all performance data)
    socket_back_log Number of sockets to queue before starting to refuse new incoming connections. This can be used to tweak the amount of simultaneous sockets that the server accepts. This is an advanced option and should not be used.
    string_length1024Length of payload to/from the NRPE agent. This is a hard specific value so you have to "configure" (read recompile) your NRPE agent to use the same value for it to work.

    Check System

    Here you can set various options to configure the System Check module.

    OptionDefault valueDescription
    CPUBufferSize1hThe time to store CPU load data.
    CheckResolution?10Time between checks in 1/10 of seconds.

    Advanced options:

    OptionDefault valueDescription
    auto_detect_pdh1Set this to 0 to disable auto detect (counters.defs) PDH language and OS version.
    dont_use_pdh_index0Set this to 1 if you dont want to use indexes for finding PDH counters.
    force_language Set this to a locale ID if you want to force auto-detection of counters from that locale.
    ProcessEnumerationMethod?autoSet the method to use when enumerating processes PSAPI, TOOLHELP or auto
    check_all_services[SERVICE_BOOT_START]ignoredSet how to handle services set to SERVICE_BOOT_START state when checking all services
    check_all_services[SERVICE_SYSTEM_START]ignoredSet how to handle services set to SERVICE_SYSTEM_START state when checking all services
    check_all_services[SERVICE_AUTO_START]startedSet how to handle services set to SERVICE_AUTO_START state when checking all services
    check_all_services[SERVICE_DEMAND_START]ignoredSet how to handle services set to SERVICE_DEMAND_START state when checking all services
    check_all_services[SERVICE_DISABLED]stoppedSet how to handle services set to SERVICE_DISABLED state when checking all services
    MemoryCommitLimit?\Memory\Commit LimitCounter to use to check upper memory limit.
    MemoryCommitByte?\Memory\Committed BytesCounter to use to check current memory usage.
    SystemSystemUpTime?\System\System Up TimeCounter to use to check the uptime of the system.
    SystemTotalProcessorTime?\Processor(_total)\% Processor TimeCounter to use for CPU load.
    ProcessEnumerationMethod?autoSet the PROCESS enumeration method (auto or TOOLHELP or PSAPI)

    External Script

    Configure how the External Scripts module works (not to be confused with the "External Scripts" section below that holds scripts that can be run.

    OptionDefault valueDescription
    command_timeout60The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
    allow_arguments0A Boolean flag to determine if arguments are accepted on the incoming socket. If arguments are not accepted you can still use external commands that need arguments but you have to define them in the NRPE handlers below. This is similar to the NRPE "dont_blame_nrpe" option.
    allow_nasty_meta_chars0Allow NRPE execution to have “nasty” meta characters that might affect execution of external commands (things like > “ etc).
    script_dir When set all files in this directory will be available as scripts. This is pretty dangerous but can be a bit useful if you use many scripts and you are sure no one else can add files there.

    External Scripts

    A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments> for instance:

    check_es_long=scripts\long.bat
    check_es_ok=scripts\ok.bat
    check_es_nok=scripts\nok.bat
    check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs
    

    External Alias

    Works like the "inject" concept of NRPE scripts module. But in short a list of aliases available. An alias is an internal command that has been "wrapped" (to add arguments). Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)

    alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s
    alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
    alias_service=checkServiceState CheckAll
    alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical
    

    Eventlog

    Some options for the EventLog? module.

    OptionDefault valueDescription
    syntax Set this to use a specific syntax string for all commands (that don't specify one)

    Advanced options:

    OptionDefault valueDescription
    debug0Log all "hits" and "misses" on the eventlog filter chain, useful for debugging eventlog checks but very very very noisy so you don't want to accidentally set this on a real machine.

    includes

    A list of other configuration files to include when reading this file. Might be useful if you have a very complex setup or want to have setting split up in segments.

    NSCA Agent

    Options to configure the new NSCA module.

    OptionDefault valueDescription
    interval60Time in seconds between each report back to the server (cant as of yet be set individually so this is for all "checks")
    nsca_host...The NSCA/Nagios(?) server to report results to.
    nsca_port5667The NSCA server port
    encryption_method1Number corresponding to the various encryption algorithms (see below). Has to be the same as the server or it wont work at all.
    password The password to use. Again has to be the same as the server or it wont work at all.

    Advanced options:

    OptionDefault valueDescription
    hostname The host name of this host if set to blank (default) the windows name of the computer will be used.
    debug_threads1Number of threads to run, no reason to change this really (unless you want to stress test something)

    Supported encryption methods:

    #Algorithm
    0None (Do NOT use this option)
    1Simple XOR (No security, just obfuscation, but very fast)
    2DES
    33DES (Triple DES)
    4CAST-128
    6xTEA
    8BLOWFISH
    9TWOFISH
    11RC2
    14RIJNDAEL-128 (AES)
    20SERPENT

    NSCA Commands

    A list of commands to run and submit each time we report back to the NSCA server. A command starting with host_ will be submitted as a host command. For an example see below: This will report back one service check (called my_cpu_check) and one host check (host checks has no service name).

    [NSCA Commands]
    my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4
    host_check=check_ok
    

    LUA Scripts

    A list of LUA script to load at startup. In difference to "external checks" all LUA scripts are loaded at startup. Names have no meaning since the script (on boot) submit which commands are available and tie that to various functions.

    [LUA Scripts]
    scripts\test.lua
    

    NRPE Handlers

    This is a list of handlers for NRPE execution this can of course be used by any module (such as NSClient) but for historical reasons they are located in this section especially as NRPE plug-in is the one that does the actual execution.

    The handlers can have two different syntaxes:

    • command[my_command]=/some/executable
    • my_command=/some/executable

    The latter is the preferred way as it is shorter.