TracNav
Internal Commands
CheckDisk...
CheckEventLog...
CheckSystem...
CheckHelpers...
CheckTaskSched...
FileLogger...
NRPEListener...
NSClientListener...
SysTray...
CheckWMI...
RemoteConfiguration...
CheckExternalScripts
LUAScript...
NSCAAgent...
Documentation...
Getting Started...
Information...
Sponsoring...
- ==External Scripts==
Donate...
CheckExternalScripts.dll
This module allows you to check external scripts and/or programs.
Configuration for the CheckExternalScripts
This page describes the configuration options for the CheckExternalScriptsmodule.
External Script
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_script
Overview
Configure how the External Scripts module works (not to be confused with the "External Scripts" section below that holds scripts that can be run.
| Option | Default value | Description |
| command_timeout | 60 | The maximum time in seconds that a command can execute. |
| allow_arguments | 0 | A Boolean flag to determine if arguments are accepted on the command line. |
| allow_nasty_meta_chars | 0 | Allow NRPE execution to have “nasty” meta characters that might affect execution of external commands. |
| script_dir | When set all files in this directory will be available as scripts. WARNING |
command_timeout
The 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.
Values:
Any number (positive integer) representing time in seconds.
- Default
- 60 (seconds).
- Example
-
Set timeout to 120 seconds
[External Script] command_timeout=120
allow_arguments
A 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.
- Values
| Value | Meaning |
| 0 | Disallow arguments for commands |
| 1 | Allow arguments for commands |
- Default
- 0 (false).
- Example
-
Allow arguments
[External Script] allow_arguments=1
allow_nasty_meta_chars
Allow NRPE execution to have “nasty” meta characters that might affect execution of external commands (things like > “ etc).
- Values
- This list contain all possible values
| Value | Meaning |
| 0 | Disallow nasty arguments for commands |
| 1 | Allow nasty arguments for commands |
- Default
- 0 (false)
- Example
-
Allow nasty arguments
[External Script] allow_nasty_meta_chars=1
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.
- Value
- Any directory (can be relative to NSClient++)
- Default
- Empty (meaning no scripts are added)
- Example
- All scripts ending with bat in the scripts folder (of NSClient++ installation directory) will be added as scripts.
[External Script] script_dir=.\scripts\*.bat
External Scripts
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_scripts
Overview
A list of scripts and their aliases 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 check_es_args=scripts\args.bat static $ARG1$ foo
To configure scripts that request arguments, use the following syntax:
check_script_with_arguments=scripts\script_with_arguments.bat $ARG1$ $ARG2$ $ARG3$
Use ./check_nrpe ... -c check_script_with_arguments -a arg1 arg2 arg3 ... Make sure you type $ARG1$ and not $arg1$ (case sensitive)
NOTICE For the above to work you need to enable allow_arguments in both NRPEListener and CheckExternalScripts!
External Alias
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_alias
Overview
A simple and nifty way to define aliases in NSClient++. Aliases are good for defining commands locally or just to simply the nagios configuration. There is a series of "useful" aliases defined in the included configuration file which is a good place to start. An alias is an internal command that has been "wrapped" (to add arguments). If you want to create an alias for an external command you can do so but it still needs the normal defnition and the alias will use the internal alias of the external command.
WARNING Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[External Aliases] 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
Examples
Check Users Logged In
This script enables you to check how many users are active (logged in via RDP) on any given server. This is especially useful for Terminal Servers to check the user load. The script also supplies performance data so you can graph the user load.
Check_users_loggedin accept none OR two arguments. Specifying only one or more then two arguments will return an error.
If no arguments are given, only the current user load is returned as an 'OK' state. Specifying a warning and critical number will return a warning or a critical state if the user load exceeds the threshold.
Sample command
check_users_loggedin=scripts\check_users_loggedin $ARG1$ $ARG2$
check_nrpe_users_loggedin,40 50 OK: Users logged in: 1|'users'=1;40;50;
Nagios configuration
define command {
command_name <<CheckUsersLoggedIn>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_users_loggedin -a 40 50
}
<<CheckUsersLoggedIn>>
Attachments
-
check_users_loggedin.vbs
(2.8 KB) - added by mike2k
7 months ago.







