NSClient++ Reference Manual PDF
NSClient++ Reference Manual PDF
About NSClient++...............................................................................................................................................1
Supported OS/Platform......................................................................................................................................2
Whats in a name?................................................................................................................................................3
Sponsorship.........................................................................................................................................................4
Fans of NSClient++.............................................................................................................................................5
Installing NSClient++.........................................................................................................................................6
1. Installation...........................................................................................................................................6
2. Configuration.......................................................................................................................................6
3. System tray..........................................................................................................................................6
4. Testing and Debugging........................................................................................................................6
5. Windows Firewall................................................................................................................................7
6. External Firewall (optional).................................................................................................................7
Installing NSClient++.........................................................................................................................................8
1. Installation...........................................................................................................................................8
2. Configuration.......................................................................................................................................8
3. System tray..........................................................................................................................................8
4. Testing and Debugging........................................................................................................................8
5. Windows Firewall................................................................................................................................9
6. External Firewall (optional).................................................................................................................9
Installation.........................................................................................................................................................10
Firewall..............................................................................................................................................................11
NT4.....................................................................................................................................................................12
SERVICE_INTERACTIVE_PROCESS 'way'..............................................................................................14
Client-server 'way'............................................................................................................................................15
Installation guide...............................................................................................................................................16
NT4, 2000, XP (old)..............................................................................................................................16
XP, 2k3, Vista, Windows 7, etc (modern).............................................................................................16
i
Table of Contents
Configuration....................................................................................................................................................18
Modules.................................................................................................................................................18
Settings...................................................................................................................................................19
includes..................................................................................................................................................19
Module Configuration......................................................................................................................................20
NRPE Listener Sections.........................................................................................................................20
NRPE Section..................................................................................................................................20
NRPE Handlers Section..................................................................................................................23
File Logging Sections............................................................................................................................24
Log Section......................................................................................................................................24
NSClient Sections..................................................................................................................................25
NSClient Section.............................................................................................................................25
Check System Sections..........................................................................................................................28
CheckSystem Section......................................................................................................................28
External Script Sections.........................................................................................................................31
External Script Section....................................................................................................................31
External Scripts Section..................................................................................................................33
External Alias Section.....................................................................................................................34
Event Log Sections................................................................................................................................34
Event Log Section...........................................................................................................................34
EventLog?.......................................................................................................................................34
NSCA Agent Sections...........................................................................................................................35
NSCA Agent Section.......................................................................................................................35
NSCA Commands Section..............................................................................................................37
LUA Scripts...........................................................................................................................................38
Problems............................................................................................................................................................39
1. I am having problems where do I start?.............................................................................................39
2. Failed to open performance counters.................................................................................................39
3. Bind failed..........................................................................................................................................39
4. "EvenlogBuffer?? is too small...........................................................................................................39
5. How do I properly escape spaces in strings.......................................................................................39
6. How do I properly escape $ in strings...............................................................................................40
7. System Tray does not work................................................................................................................40
Older WIndows...............................................................................................................................40
"modern" windows..........................................................................................................................40
Modules..............................................................................................................................................................41
CheckDisk..............................................................................................................................................41
CheckEventLog......................................................................................................................................41
CheckSystem.........................................................................................................................................41
CheckHelpers.........................................................................................................................................41
FileLogger..............................................................................................................................................41
NRPEListener........................................................................................................................................42
NSClientListener...................................................................................................................................42
SysTray..................................................................................................................................................42
CheckWMI.............................................................................................................................................42
ii
Table of Contents
Modules
CheckTaskSched....................................................................................................................................42
CheckExternalScripts.............................................................................................................................42
LUAScript..............................................................................................................................................42
NSCAAgent...........................................................................................................................................42
RemoteConfiguration.............................................................................................................................42
All Commands...................................................................................................................................................43
CheckDisk.dll....................................................................................................................................................44
Configuration Sections..........................................................................................................................44
CheckFileSize....................................................................................................................................................46
Examples................................................................................................................................................46
Check the size of the windows directory.........................................................................................46
Check the size of the pagefile.sys...................................................................................................46
Multiple files...................................................................................................................................47
Single file........................................................................................................................................47
Some exchange database thing........................................................................................................48
CheckDriveSize.................................................................................................................................................49
Examples................................................................................................................................................49
Check C:..........................................................................................................................................49
Volumes...........................................................................................................................................50
All fixed and network disks.............................................................................................................50
Fixed and Network (ignore some)...................................................................................................51
Checking UNC Paths.......................................................................................................................51
Simple Config..................................................................................................................................51
CheckFile...........................................................................................................................................................53
CheckFile2.........................................................................................................................................................54
Syntax....................................................................................................................................................54
Order......................................................................................................................................................54
Filter modes...........................................................................................................................................54
Filter Types............................................................................................................................................54
time expression................................................................................................................................55
string expression..............................................................................................................................55
Filter in/out............................................................................................................................................55
CheckEventLog.dll............................................................................................................................................56
Configuration Sections..........................................................................................................................56
EventLog?.......................................................................................................................................56
iii
Table of Contents
Configuration for the CheckEventLog...........................................................................................................58
Configuration Sections..........................................................................................................................58
EventLog?.......................................................................................................................................58
CheckEventLog.................................................................................................................................................60
Syntax....................................................................................................................................................60
Order......................................................................................................................................................61
Filter modes...........................................................................................................................................61
Filter Types............................................................................................................................................61
event type expression......................................................................................................................62
event severity expression.................................................................................................................62
time expression................................................................................................................................62
string expression..............................................................................................................................62
Filter in/out............................................................................................................................................62
Unique....................................................................................................................................................63
Examples................................................................................................................................................63
Sample Eventlog Command............................................................................................................63
Another sample................................................................................................................................63
Check if a script is running as it should..........................................................................................64
CheckSystem.dll................................................................................................................................................65
Command Line......................................................................................................................................65
Configuration Sections..........................................................................................................................65
CheckSystem Section......................................................................................................................65
CheckCPU.........................................................................................................................................................73
Configuration.........................................................................................................................................73
FAQ.......................................................................................................................................................73
Examples................................................................................................................................................73
Sample Command...........................................................................................................................73
Multiple Time entry.........................................................................................................................74
check_load.......................................................................................................................................74
CheckUpTime....................................................................................................................................................75
Examples................................................................................................................................................75
CheckServiceState.............................................................................................................................................76
Configuration.........................................................................................................................................76
Examples................................................................................................................................................76
Sample check...................................................................................................................................76
Auto started.....................................................................................................................................76
Service name with spaces................................................................................................................77
iv
Table of Contents
CheckProcState.................................................................................................................................................78
Examples................................................................................................................................................79
Process running/not running............................................................................................................79
Process running/not running............................................................................................................79
Check number of processes running...............................................................................................80
Substrings and commandline...........................................................................................................80
More process counts........................................................................................................................80
CheckMem.........................................................................................................................................................82
Examples................................................................................................................................................82
Page.................................................................................................................................................82
Physical...........................................................................................................................................83
Multiple...........................................................................................................................................83
CheckCounter...................................................................................................................................................84
FAQ.......................................................................................................................................................84
Command line........................................................................................................................................84
check_nt vs. check_nrpe........................................................................................................................84
Examples................................................................................................................................................85
Sample Command...........................................................................................................................85
Using Instances................................................................................................................................85
Microsoft Exchange 5.5 IS RPC Operations / Sec..........................................................................85
Windows 2000/2003 Physical Disk Time.......................................................................................86
CheckHelpers.dll...............................................................................................................................................87
Configuration.........................................................................................................................................87
CheckAlwaysOK...............................................................................................................................................88
Examples................................................................................................................................................88
CheckAlwaysCRITICAL.................................................................................................................................89
Examples................................................................................................................................................89
CheckAlwaysWARNING.................................................................................................................................90
Examples................................................................................................................................................90
CheckOK...........................................................................................................................................................91
Examples................................................................................................................................................91
CheckCRITICAL..............................................................................................................................................92
Examples................................................................................................................................................92
CheckWARNING.............................................................................................................................................93
Examples................................................................................................................................................93
CheckMultiple...................................................................................................................................................94
Examples................................................................................................................................................94
v
Table of Contents
CheckVersion....................................................................................................................................................95
Examples................................................................................................................................................95
CheckTaskSched.dll..........................................................................................................................................96
Configuration.........................................................................................................................................96
CheckTaskSched...............................................................................................................................................97
FileLogger.dll....................................................................................................................................................98
Configuration Sections..........................................................................................................................98
Overview.........................................................................................................................................98
NRPEListener.dll............................................................................................................................................102
Configuration Sections........................................................................................................................102
NRPE Section................................................................................................................................102
NRPE Handler Section..................................................................................................................105
NSClientListener.dll.......................................................................................................................................112
Configuration Sections........................................................................................................................112
NSClient Section...........................................................................................................................112
Examples..............................................................................................................................................114
SysTray.dll.......................................................................................................................................................118
CheckWMI.dll.................................................................................................................................................119
Configuration.......................................................................................................................................119
CheckWMI......................................................................................................................................................120
Filters...................................................................................................................................................120
Filter <Mode>s....................................................................................................................................121
Filter <Type>s......................................................................................................................................121
Filter <Columns>s...............................................................................................................................121
string expression..................................................................................................................................121
columnSyntax......................................................................................................................................121
vi
Table of Contents
CheckWMI
Examples..............................................................................................................................................121
A sample query..............................................................................................................................121
Using Query Alias.........................................................................................................................122
Overriding Query Alias.................................................................................................................122
Checking With filters....................................................................................................................123
Debbuging queries.........................................................................................................................123
CheckWMIValue............................................................................................................................................124
Examples..............................................................................................................................................124
CHeck Threads in a process..........................................................................................................125
Ping status......................................................................................................................................125
Using from command line.............................................................................................................126
CheckExternalScripts.dll...............................................................................................................................127
Configuration for the CheckExternalScripts........................................................................................127
External Script...............................................................................................................................127
External Scripts.............................................................................................................................129
External Alias................................................................................................................................129
LUAScript.dll..................................................................................................................................................134
Configuration.......................................................................................................................................134
[LUA Scripts]................................................................................................................................134
Debugging Lua................................................................................................................................................135
A simple script.................................................................................................................................................136
Structure of a script........................................................................................................................................137
A 'useful' script...............................................................................................................................................138
NSCAAgent.dll................................................................................................................................................139
Configuration.......................................................................................................................................139
NSCA Agent Section.....................................................................................................................139
NSCA Commands Section............................................................................................................141
vii
Table of Contents
Configuration for the NSCAAgent
NSCA Commands Section...................................................................................................................144
Overview.......................................................................................................................................144
viii
About NSClient++
NSClient++ (or nscp as I tend to call it nowadays) aims to be a simple yet powerful and secure monitoring
daemon for Windows operating systems. It is built for Nagios, but nothing in the daemon is actually Nagios
specific and could probably, with little or no change, be integrated into any monitoring software that supports
running user tools for polling.
The structure of the daemon is a simple NT service that loads plug-ins to an internal stack. The plug-ins can
then request data (poll performance data) from the other plug-ins through the internal stack. As of now there
are a few plug-ins for basic performance data collection. For details of supplied modules, see
CheckCommands.
NSClient++ can be extended in two ways: you can either write your own plug-in or you can execute an
external script (as of now batch/exe/*). Writing your own plug-in is, of course, the most powerful way but
requires knowledge of C++ or other languages which can produce DLLs and interface with regular C
programs (generally, every other language available, but there is some simple API helpers for C/C++ as well
as descriptions).
As for checking with NSClient++, I would recommend NRPE as it is a lot more flexible than check_nt. But
NSClient has full support for check_nt, and if there is an interest, I could probably add support for check_nt
from nc_net.
About NSClient++ 1
Supported OS/Platform
NSClient++ should run on the following operating systems:
NT4 (SP5?)
Windows 2000 W2K
Windows XP
Windows 2003
Windows Vista
...
Win32
x64 (AMT64/EMT64)
IA64 (Itanium)
Supported OS/Platform 2
Whats in a name?
Since I have noticed some ppl. use other names for the client I decided to list them here to make it simpler (ie.
Goggle might find it) for people to find it.
:-)
My Name is Michael Medin and I am the author of this program (an also handles a lot of the support and
such).
Messengers:
Communities:
LinkedIn?: http://www.linkedin.com/in/mickem
Last.fm: http://www.last.fm/user/mickem
LibraryThing?: http://www.librarything.com/profile/mickem
...
Whats in a name? 3
Sponsorship
NSClient++ is a free and open source tool not backed by any commercial entity. In fact I don't even work with
Nagios so this is a 100% "spare time effort".
So if you like and use NSClient++ and perhaps even make money from using it. Feel free to become an
official sponsor of NSClient++. The sponsoring program is pretty loose as of yet but the main ideas are to
have three "levels" of sponsoring:
Gold Sponsor
Contribution: Euro 1'000 / year
You get you company logo in the projects (this site) website navigation bar. Visible on
around 75.000 page impressions per month (12-15.000 unique visitors per month).
Free e-mail support1 (5 premium2 issues)
Custom built3 (branded) version of NSClient++ (optional)
Silver Sponsor
Contribution: Euro 100 / year
You get your company logo on the sponsors page of the projects website (this page).
Free e-mail support1 (1 premium2 issue).
NSClient++ Fan
Any kind of donation
You get your name listed together with your donation on the NSClient++ fan page.
"Free support" (when I or the community have the time)
Become a Fan today
If you have any questions about becoming a sponsor, please be contact me on info@?.
If you have donated before and want to be listed on the fan page contact me and I will add you, since there
was no "opt out" I am hesitant to add peoples names without prior consent.
Sponsorship 4
Fans of NSClient++
A lit of fans (who have donated to the project):
Fans of NSClient++ 5
Installing NSClient++
This is a grooving process before it was all manual but slowly we are getting a more "automated" installation
process so hopefully this will keep improving in the future as well and some of the steps might go away.
1. Installation
NSClient++ comes with an interactive installer (MSI) which should preferably be used. There is also a
command line option for registering (and de-registering) the service for details refer to the manual installation
guide. If you are using Windows NT4 there is some dependencies you need to manually install for details
refer to the NT4 Dependency guide.
Thus to install the Client you simply click the MSI package (for your platform) and follow the wizard
through. BUT and this is a big but after you have installed it it still needs to be configure (which is done with
your favorite text editor).
2. Configuration
Before you start NSClient++ you need to configure it by editing the configuration file (NSC.ini). The
configuration file is a simple text file and is explained in detail under Configuration.
The configuration file (NSC.ini) NEEDS to be configured as for security reasons all plug-ins are disabled by
default. The reason for this is so no one will accidentally install this and get potential security issues, I believe
that things should be "off" by default. Also notice that by default allowed_hosts are 127.0.0.1 so you need to
modify this as well.
3. System tray
If you plan to use the SystemTray module (that shows a system tray icon on the desktop you need to install
the SystemTray module as well as NSClient++ on "old" versions of windows (XP and blow) on modern
version of windows (XP and above) you can used the new experimental shared session support. For details on
this see the System tray installation guide.
When you are starting yout and/or configuring your client you can use the "debug" mode which will be very
helpfull as you will see the debug log in "real time" whrn you play around with it. To start NSClient++ in
test/debug mode use the following command (you can also use the icon on the start menu):
NSClient++ /test
Installing NSClient++ 6
5. Windows Firewall
I have yet to foigure this one out but hopefully someone can help me write this! I shall for the next version try
to make an automated exception thingy for the windows firewall.
If you use NRPEListener (check_nrpe) you need the NRPE port open (usually 5666) from the nagios
server towards the client.
If you use the NSClientListener (check_nt) you need the (modified) NSClient port open (usually
12489) from the nagios server towards the client.
If you use the NSCA Module (passive checks) you need the NSCA port open from the client towards
the nagios server. client:* -> nagios:5667
If you use the NRPEClient module to check any remote systems (use NSClient++ as a proxy) you
need to have NRPE port (usually 5666) open from NSClient++ (the proxy) to the remote-client in
addition to the method you use to submit the results to the server. nsclient-proxy:* ->
remote-client:5666
Source Destination
Protocol Source Destination Comment
port port
The nagios server initiates a call to the client
NRPE nagios <all> Client 5666
on port 5666
The nagios server initiates a call to the client
NSClient nagios <all> Client 12489
on port 12489
The client initiates a call to the nagios server
NSCA client <all> nagios 5667
on port 5667
The client initiates a call to the remote client
NRPE-proxy client <all> remote-client 5666
on port 5666
5. Windows Firewall 7
Installing NSClient++
This is a grooving process before it was all manual but slowly we are getting a more "automated" installation
process so hopefully this will keep improving in the future as well and some of the steps might go away.
1. Installation
NSClient++ comes with an interactive installer (MSI) which should preferably be used. There is also a
command line option for registering (and de-registering) the service for details refer to the manual installation
guide. If you are using Windows NT4 there is some dependencies you need to manually install for details
refer to the NT4 Dependency guide.
Thus to install the Client you simply click the MSI package (for your platform) and follow the wizard
through. BUT and this is a big but after you have installed it it still needs to be configure (which is done with
your favorite text editor).
2. Configuration
Before you start NSClient++ you need to configure it by editing the configuration file (NSC.ini). The
configuration file is a simple text file and is explained in detail under Configuration.
The configuration file (NSC.ini) NEEDS to be configured as for security reasons all plug-ins are disabled by
default. The reason for this is so no one will accidentally install this and get potential security issues, I believe
that things should be "off" by default. Also notice that by default allowed_hosts are 127.0.0.1 so you need to
modify this as well.
3. System tray
If you plan to use the SystemTray module (that shows a system tray icon on the desktop you need to install
the SystemTray module as well as NSClient++ on "old" versions of windows (XP and blow) on modern
version of windows (XP and above) you can used the new experimental shared session support. For details on
this see the System tray installation guide.
When you are starting yout and/or configuring your client you can use the "debug" mode which will be very
helpfull as you will see the debug log in "real time" whrn you play around with it. To start NSClient++ in
test/debug mode use the following command (you can also use the icon on the start menu):
NSClient++ /test
Installing NSClient++ 8
5. Windows Firewall
I have yet to foigure this one out but hopefully someone can help me write this! I shall for the next version try
to make an automated exception thingy for the windows firewall.
If you use NRPEListener (check_nrpe) you need the NRPE port open (usually 5666) from the nagios
server towards the client.
If you use the NSClientListener (check_nt) you need the (modified) NSClient port open (usually
12489) from the nagios server towards the client.
If you use the NSCA Module (passive checks) you need the NSCA port open from the client towards
the nagios server. client:* -> nagios:5667
If you use the NRPEClient module to check any remote systems (use NSClient++ as a proxy) you
need to have NRPE port (usually 5666) open from NSClient++ (the proxy) to the remote-client in
addition to the method you use to submit the results to the server. nsclient-proxy:* ->
remote-client:5666
Source Destination
Protocol Source Destination Comment
port port
The nagios server initiates a call to the client
NRPE nagios <all> Client 5666
on port 5666
The nagios server initiates a call to the client
NSClient nagios <all> Client 12489
on port 12489
The client initiates a call to the nagios server
NSCA client <all> nagios 5667
on port 5667
The client initiates a call to the remote client
NRPE-proxy client <all> remote-client 5666
on port 5666
5. Windows Firewall 9
Installation
NSClient++ comes simple command line option for registering (and deregistering) the service but it does not
have a GUI installer.
Thus to install the Client you only need to copy the files to a directory of your choice and then run
?NSClient++ /install?.
Before you start NSClient++ you need to configure it by editing the configuration file (NSC.ini). The
configuration file is a simple text file and is explained in detail under Configuration. The files needed by
NSClient++ varies but mainly the exe and DLL's in the NSClient++ root are required as well as all the
modules you plan to use from the modules subdirectory (/modules/*).
The configuration file (NSC.ini) NEEDS to be configured as for security reasons all plug-ins are disabled by
default. The reason for this is so no one will accidentally install this and get potential security issues, I believe
that things should be "off" by default. Also notice that by default allowed_hosts are 127.0.0.1 so you need to
modify this as well.
If you plan to use the SystemTray module (that shows a system tray icon on the desktop you need to install
the SystemTray module as well as NSClient++. To install NSClient++ execute the following command:
NSClient++ /install
NSClient++ SysTray install
NSClient++ /start
NSClient++ /stop
If you only wish to test it or debug the client you can use the following without installing it first.
NSClient++ /test
Installation 10
Firewall
Firewall configuration should be pretty straight forward:
If you use NRPEListener (check_nrpe) you need the NRPE port open (usually 5666) from the nagios server
towards the client.
If you use the NSClientListener (check_nt) you need the (modified) NSClient port open (usually 12489) from
the nagios server towards the client.
If you use the NSCA Module (passive checks) you need the NSCA port open from the client towards the
nagios server.
If you use the NRPEClient module to check any remote systems (use NSClient++ as a proxy) you need to
have NRPE port (usually 5666) open from NSClient++ (the proxy) to the remote-client in addition to the
method you use to submit the results to the server.
Firewall 11
NT4
NT4 does not come with the PDH library and you need to install that before using NSClient++. PDH can be
downloaded from Microsoft: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284996 and the
simplest way to install it is to uncompress it directly into the NSClient++ directory.
NT4 also (sometimes) lack the PSAPI helper which is available in the "Platform SDK Redistributable: PSAPI
for Windows NT" from Microsoft.
http://www.microsoft.com/downloads/details.aspx?FamilyID=3d1fbaed-d122-45cf-9d46-1cae384097ac as
with the PDH either install in system32 or local NSClient++ directory.
NT4 12
System Tray Installation Guide
This is a subject which I think many people have trouble with so I wrote up a simple guide for it.
The first thing you should understand is that there are two ways in windows to do "system trays".
The details on a technical level is that the service has a flag "SERVICE_INTERACTIVE_PROCESS" which
allows it to interact with the "desktop" so what we do in NSClient++ is simply add an icon to the desktop and
voila system tray support in a few lines of code all neat and tidy inside the same process.
SERVICE_INTERACTIVE_PROCESS 'way' 14
Client-server 'way'
Now since the "old" way was so simple Microsoft had to go about changing it (of course) so the "new" way
which works from (including) XP and above. Technically it works from Windows 2000 but slightly different
so I would recommend using it on XP and above.
The reason for this is that in "modern" windows there is no "desktop" there is instead several desktops one of
which is there the system tray from NSClient++ will end up (session 0). And unfortunately this (session 0) is
not the one where the logged in user ends up (which is session 1 and above). This is all down to the "User
switching" which was introduced when terminal server was "sort of integrated" into windows 2000.
Quite simply we can launch a program in the logged in users session and have them communicate with each
other.
This is done by triggering on the "user logged in" (or as it is called in the debug log "Got session change...")
and if enabled (shared_session=1) launch a process into that users session and hope that they will
communicate with each other. The actual communication is done using a shared session (technically a bunch
of shared semaphores and a bunch of shared memory areas).
BETA WARNING Now this will introduce a lot of challenges and problems and as of now it is more of a
technical preview then a stable and mature thing I would enable in production.
Client-server 'way' 15
Installation guide
THis is split into two section "old" and "modern".
[modules]
SysTray.dll
Then run:
And:
Installation guide 16
Dependencies for Windows NT4
Since windows NT4 is OLD (yes it is really old and you should think about upgrading) it has some
dependencies which I have decided not to resolve easily. This means you need to install some Microsoft
components to get tings up and running on Windows NT4.
Hopefully this should not be to hard and not cause you any problems.
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:
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.
CheckDisk (module)
CheckEventLog (module)
CheckExternalScripts (module)
CheckHelpers (module)
CheckSystem (module)
CheckTaskSched (module)
CheckWMI (module)
FileLogger (module)
LUAScript (module)
NRPEListener (module)
NSCAAgent (module)
NSClientListener (module)
RemoteConfiguration (module)
SysTray (module)
Configuration 18
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.
Default
Option Description
value
An obfuscated version of password. For more details refer to the password
obfuscated_password ... option below. To create the obfuscated Password use: "NSClient++.exe
/encrypt"
The password used by various (presently only NSClient) daemons. If no
password ...
password is set everyone will be able to use this service remotely.
A 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:
allowed_hosts 127.0.0.1
NSClient++ will not resolve the IP address of DNS entries if the service is
set to startup automatically. Use an IP address instead.
Has to be set to 1 if you want the file to be read (if set to 0, and the use_reg
use_file 0
is set to 1 the registry will be used instead)
Advanced options:
Default
Option Description
value
master_key ... The secret "key" used when (de)obfuscating passwords.
Used to cache looked up hosts if you check dynamic/changing hosts set
cache_allowed_hosts 1
this to 0.
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.
Settings 19
Module Configuration
NRPE Listener Sections
NRPE Section
This is section is included from the following page NRPEListener/config/nrpe
1. 1. 1. 1. Overview
1. port
2. allowed_hosts
3. use_ssl
4. bind_to_address
5. command_timeout
6. allow_arguments
7. allow_nasty_meta_chars
8. socket_timeout
9. script_dir
10. performance_data
11. socket_back_log
12. string_length
Overview
This is configuration for the NRPE module that controls how the NRPE listener operates.
Module Configuration 20
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.
Length of payload to/from the NRPE agent. This is a hard specific value so you
string_length 1024 have to "configure" (read recompile) your NRPE agent to use the same value for
it to work.
Load all scripts in a directory and use them as commands. Probably dangerous
script_dir
but usefull if you have loads of scripts :)
bind_to_address The address to bind to when listening to sockets.
port
Default
5666
allowed_hosts
A list (comma 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
Default
Empty list (falls back to the one defined under [Settings]
use_ssl
Boolean value to toggle SSL (Secure Socket Layer) encryption on the socket connection. This corresponds to
the -n flag in check_nrpe
Values
Value Meaning
0 Don't use SSL
1 Use SSL encryption
Default
1 (enabled)
bind_to_address
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
Values
IP address of any interface of the server.
Default
Empty (first (all?) interface will be used)
NRPE Section 21
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 so internal commands may execute forever.
It is usually a good idea to set this to less then the timeout used with check_nrpe
Default
60
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.
NOTICE That there are more then one place to set this!
Default
0 (means don't allow arguments)
Values
Value Meaning
0 Don't allow arguments
1 Allow arguments.
allow_nasty_meta_chars
Allow NRPE execution to have ?nasty? meta characters that might affect execution of external commands
(things like > ? etc).
Default
0 (means don't allow meta characters)
Values
Value Meaning
0 Don't allow meta characters
1 Allow meta characters
socket_timeout
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
script_dir
Load all scripts in a directory and use them as commands. Probably dangerous but useful if you have loads of
scripts :)
NRPE Section 22
Default
Empty (don't load any scripts)
performance_data
Send performance data back to Nagios (set this to 0 to remove all performance data)
Default
1
Values
Value Meaning
0 Don't send performance data
1 Send 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_length
Length 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.
Default
1024
1. 1. 1. 1. Ovreview
1. Alias (builtin commands)
2. NRPE_NT Syntax
Ovreview
DEPRECATED This part of the module is deprecated and should not be used. Refer to the
[CheckExternalScripts] module instead. This module can add two types of command handlers.
First there are external command handlers that execute a separate program or script and simply return the
output and return status from that. The other possibility is to create an alias for an internal command.
To add an external command you add a command definition under the ?NRPE Handlers? section. A command
definition has the following syntax:
[NRPE Handlers]
command_name=/some/executable with some arguments
test_batch_file=c:\test.bat foo $ARG1$ bar
command[check_svc]=inject CheckService checkAll
NRPE Section 23
The above example will on an incoming ?test_batch_file? execute the c:\test.bat file and return the output as
text and the return code as the Nagios status.
To add an internal command or alias is perhaps a better word. You add a command definition under the
?NRPE Handlers? section. A command definition with the following syntax:
The above example will on an incoming ?check_cpu? execute the internal command ?checkCPU? with
predefined arguments give in the command definition.
NRPE_NT Syntax
To leverage existing infrastructure you can copy your old definitions from NRPE_NT as-is. Thus the
following:
CheckServcice checkAll
1. 1. 1. 1. Overview
1. debug
2. file
3. date_mask
4. root_folder
Overview
This section has options for how logging is performed with the [FileLogger] module. 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.
A Boolean value that toggles if debug information should be logged or not. This can be either 1 or 0.
Default
0
Values
Value Meaning
0 Don't log debug messages
1 Log debug messages
file
The file to write log data to. If no directory is used this is relative to the NSClient++ binary.
Default
nsclient.log
date_mask
Default
%Y-%m-%d %H:%M:%S
root_folder
Default
exe
Values
The file system directory that contains application data for all users. A typical path is
C:\Documents and Settings\All Users\Application Data. This folder is used for application
local-app-data data that is not user specific. For example, an application can store a spell-check dictionary, a
database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This
information will not roam and is available to anyone using the computer.
exe Location of NSClient++ binary
NSClient Sections
NSClient Section
This is section is included from the following page NSClientListener/config
1. 1. 1. 1. Ovreview
Log Section 25
1. port
2. obfuscated_password
3. password
4. allowed_hosts
5. bind_to_address
6. socket_timeout
7. socket_back_log
8. version
Ovreview
Default
Option Description
value
port 12489 The port to listen to
obfuscated_password An obfuscated version of password.
password The password that incoming client needs to authorize themselves by.
A list (coma separated) with hosts that are allowed to connect to
allowed_hosts
NSClient++ via NSClient protocol.
socket_timeout 30 The timeout when reading packets on incoming sockets.
Advanced options:
Default
12489
obfuscated_password
An obfuscated version of password. For more details refer to the password option below.
Default
Empty string whjich means we will use the value from password instead.
NSClient Section 26
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.
Default
Empty string whjich means we will use the value from password in the [Settings] section instead.
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.
Default
Empty list (falls back to the one defined under [Settings]
bind_to_address
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
Values
IP address of any interface of the server.
Default
Empty (first (all?) interface will be used)
socket_timeout
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
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.
version
The 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++
Values:
NSClient Section 27
If given any str4ing will be returned unless auto in which case the proper
version will be returned
Default
auto
1. 1. 1. 1. Overview
1. CPUBufferSize
2. CheckResolution?
3. auto_detect_pdh
4. dont_use_pdh_index
5. force_language
6. ProcessEnumerationMethod?
7. check_all_services[<key>]
8. MemoryCommitLimit?
9. MemoryCommitByte?
10. SystemSystemUpTime?
11. SystemTotalProcessorTime?
12. debug_skip_data_collection
Overview
The configuration for the CheckSystsem? module should in most cases be automagically detected on most
versions of windows (if you have a problem with this let me know so I can update it). Thus you no longer
need to configure the advanced options. There is also some other tweaks that can be configured such as check
resolution and buffer size.
The time to store CPU load data. The larger the buffer the more memory is used. This is a time value which
takes an optional suffix for which time denominator to use:
Suffix Meaning
s second
m minutes
h|hour
d day
Default
1h
CheckResolution?
Default
10
auto_detect_pdh
Set this to 0 to disable auto detect (counters.defs) PDH language and OS version.
Values
Value Meaning
0 Don't attempt automagically detect the counter names used.
1 Use various menthods to figure out which counters to use.
Default
1
dont_use_pdh_index
When autodetecting counter names do NOT use index to figure out the values.
Values
CheckSystem Section 29
Value Meaning
0 Use indexes to automagically detect the counter names used.
1 Do NOT use indexes to figure out which counters to use.
Default
0
force_language
When index detection fails your local is used. Here you can override the default local to force another one if
the detected local is incorrect.
Values
Any locale string like SE_sv (not sure here haven't used in years)
Deafult
Empty string which means the system local will be used.
ProcessEnumerationMethod?
DEPRECATED Set the method to use when enumerating processes PSAPI, TOOLHELP or auto No longer
used (only PSAPI is supported).
check_all_services[<key>]
When using check all in a service check the default behaviour is that service set to auto-start should be started
and services set to disabled should be stopped. This can be overridden using this option. Keys avalible:
Default
\Memory\Commit Limit
MemoryCommitByte?
Default
\Memory\Committed Bytes
CheckSystem Section 30
SystemSystemUpTime?
Default
\System\System Up Time
SystemTotalProcessorTime?
Default
\Processor(_total)\% Processor Time
debug_skip_data_collection
Default
0
1. 1. 1. 1. Ovreview
1. command_timeout
2. allow_arguments
3. allow_nasty_meta_chars
4. script_dir
Ovreview
Configure how the External Scripts module works (not to be confused with the "External Scripts" section
below that holds scripts that can be run.
Default
Option Description
value
command_timeout 60 The maximum time in seconds that a command can execute.
A Boolean flag to determine if arguments are accepted on the command
allow_arguments 0
line.
Allow NRPE execution to have ?nasty? meta characters that might
allow_nasty_meta_chars 0
affect execution of external commands.
When set all files in this directory will be available as scripts.
script_dir
WARNING
CheckSystem Section 31
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:
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
[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
1. 1. 1. 1. Ovreview
Ovreview
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
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!
1. 1. 1. 1. Ovreview
Ovreview
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.
[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
EventLog?
The [EventLog?] section is used by the CheckEventLog module.
Advanced options:
Used to log all information regarding hits and misses on the filtering,. This has sever performance impact as
well as log file will grow so do not use unless you are debugging.
[EventLog]
debug=1
This parameter is set in the nsc.ini file and needs to be put under a heading of [EventLog?] (this heading may
need to be created). The buffer reserves memory each time an eventlog check is being run when so set the size
accordingly (or you will be wasting lots of memory).
To change the default setting of 64KB add (or edit) in the nsc.ini file an entry for buffer size
(buffer_size=512000) where the value is in bytes. Often times the buffer size will need to be increased when
using the %message% variable in return results. Most often you only need to increase this if you get error
reported in the log file from NSClient++
[EventLog]
buffer_size=512000
Complete configuration
This are the default values for the entire EventLog? section
[EventLog]
debug=0
buffer_size=64000
1. 1. 1. 1. Ovreview
1. interval
2. nsca_host
3. nsca_port
4. encryption_method
5. password
6. hostname
7. debug_threads
Ovreview
Default
Option Description
value
Time in seconds between each report back to the server (cant as of yet be set
interval 60
individually so this is for all "checks")
nsca_host ... The NSCA/Nagios(?) server to report results to.
EventLog? 35
nsca_port 5667 The NSCA server port
Number corresponding to the various encryption algorithms (see below). Has
encryption_method 1
to be the same as the server or it wont work at all.
The password to use. Again has to be the same as the server or it won't work
password
at all.
Advanced options:
Time in seconds between each report back to the server (cant as of yet be set individually so this is for all
"checks")
Value
Any positive integer (time in seconds)
Default
60 (seconds)
nsca_host
Values
Hostname or IP address to submit back results to.
Default
Empty string (will in 3.7 and above mean don't submit results)
nsca_port
Values
Any positive integer (port number ought to be less then 65534)
Default
5667
encryption_method
Number corresponding to the various encryption algorithms (see below). Has to be the same as the server or it
wont work at all.
Values
# Algorithm
Default
1 (I am note sure I thought default was 14?)
password
The password to use. Again has to be the same as the server or it won't work at all.
Values
Any string (should be the same as the one configured in nsca.conf
hostname
The host name of this host if set to blank (default) the windows name of the computer will be used.
Values
Any string (or auto)
Default
auto (means windows hostname will be used)
debug_threads
DEBUGNumber of threads to run, no reason to change this really (unless you want to stress test something)
Values
Any positive integer larger then or equal to 1
Default
1
1. 1. 1. 1. Overview
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 have 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
nsclient++ /test
1. it starts the deamon as "usual" with the same configuration and such.
2. it enables debug logging and logs to the console.
This makes it quite easy to see what is going on and why things go wrong. .
3. Bind failed
Usually this is due to running more then once instance of NSClient++ or possibly running another
program that uses the same port.
Make sure you don't have any other instance NSCLient++ started.
Check if the port is in use (netstat -a look for LISTENING)
[EventLog]
buffer_size=128000
There are hundreds of options not in the ini file (all covered in the docs though). The default ini is more a
"common ones" and not a complete set.
the ini file that comes with the installation does not contain this variable by default.
Problems 39
nagios:
As usual you can do it anyway you like but I prefer: check_nrpe ... 'this is a string'
NSClient++ (inject, alias, external, etc...)
The parser is badly written so the only option is:
filter-message="substr:Hello World"
filter-message=substr:"Hello World"
nagios:
$$ (you use two $ signs)
from NSClient++
$ (you do not need to escape them at all)
[modules]
SysTray.dll
"modern" windows
If you are using "modern" windows ie. vista, 2k3, 2k8, etc etc there is no "session 0" (or there is but you do
not see it by default) so they sytray (which ends up on session 0) wont be visible by your session 1 (or above).
Thus I started work on a new "modern implementation" this comes in the form of a shared session (based on
shared memory and mutexes). But since this is rather new it is very experimental so use it with care! To
enable shared session do the following:
[modules]
; SysTray.dll <--- NOTICE THE COMMENT
[Settings]
shared_session=1
CheckDisk
Module to do various disk related checks.
CheckEventLog
Module to check event log
CheckSystem
Module to check system related things
CheckHelpers
Various helper function, doesn't check anything in it self but can help make things simpler.
FileLogger
Logs all messages (errors, warnings etc) to a file.
Modules 41
NRPEListener
Listens for incoming NRPE calls and handles them by injecting them into the core. It also listens for all NRPE
definitions and executes them
NSClientListener
Listens for incoming NSClient calls and handles them accordingly. This only allows a limited subset of
functionality and NRPE is recommended.
SysTray
A simple module to show an icon in the tray when the service is running this module does not export any
check commands.
CheckWMI
CheckWMI, Check large resultsets from (for instance are there more then 5-rows matching criteria X,
ie. more than 5 internet explorer processes which uses more than 123Mb memory).
CheckWMIValue, Check the result of a query (ie. are the current memory utilization over X)
CheckTaskSched
CheckTaskSched, Check if scheduled tasks are working/scheduled/*.
CheckExternalScripts
BETA User defined check commands, allows writing check scripts in external languages (VB, batch, EXE,
*).
LUAScript
BETA User defined check commands, allows writing check scripts (and wrap others in) the Lua scripting
language.
NSCAAgent
BETA No check commands, has functions to send results from check_commands to a NSCA server.
RemoteConfiguration
BETA No check commands, has functions to manage the configuration remotely.
NRPEListener 42
All Commands
A list of all commands (alphabetically).
CheckAlwaysCRITICAL (check)
CheckAlwaysOK (check)
CheckAlwaysWARNING (check)
CheckCPU (check)
CheckCRITICAL (check)
CheckCounter (check)
CheckEventLog/CheckEventLog (check)
CheckFile (check)
CheckFileSize (check)
CheckMem (check)
CheckMultiple (check)
CheckOK (check)
CheckProcState (check)
CheckServiceState (check)
CheckTaskSched/CheckTaskSched (check)
CheckUpTime (check)
CheckVersion (check)
CheckWARNING (check)
CheckWMI/CheckWMI (check)
CheckWMIValue (check)
All Commands 43
CheckDisk.dll
The CheckDisk module has various disk and file related checks. You can either check disk drive and volume
sizes as well as files and directories.
Configuration Sections
This is a wrapper page the actual data is on the following page CheckDisk/config
CheckDisk.dll 44
Configuration for the CheckDisk
This page describes the configuration options for the CheckDisk module.
This is a wrapper page the actual data is on the following page CheckDisk/config
Configuration Sections
This module has no configuration.
This check does a recursive size calculation of the directory (or file) specified. A request has one or more
options described in the table below. The order only matter in that the size has to be specified before the File
option this because you can change the size for each drive by specifying multiple Size options.
Examples
Check the size of the windows directory
Check the size of the windows directory and make sure it stays below 1 gigabyte. Sample Command:
Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MaxWarn=$ARG1$ Max
}
<<CheckFileSize>> 1024M!4096M!_WIN!c:\WINDOWS\*.*
CheckFileSize 46
OK: c:\pagefile.sys: 1G (1610612736B)
Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MinWarn=$ARG2$ Mi
}
<<CheckFileSize>> 512M!1G
Multiple files
Sample of using individual size for multiple files. Sample Command:
Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File
}
<<CheckFileSize>>
Single file
I have had to set this up like this for our Windows Server. Sample Command:
Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=2G MaxCrit=4G File
}
<<CheckFileSize>>
Nagios Configuration:
define command {
command_name <<CheckFileSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a MaxWarn=$ARG1$ MaxCrit=$AR
}
<<CheckFileSize>> 13G!15.5G!d:\\exchsrvr\\mdbdata\\priv1.edb
This check verifies the size of various drives specified on the command line. A request has one or more
options described in the table below. The order only matters in that the size has to be specified before the
Drive option because you can change the size for each drive by specifying multiple Size options.
Examples
Check C:
Check the size of C:\ and make sure it has 10% free space:
Sample Command:
CRITICAL: C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) <critical
Nagios Configuration:
define command {
command_name <<CheckDriveSize>>
CheckDriveSize 49
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=$ARG2
}
<<CheckDriveSize>> c:,5%!10%
Volumes
To check the size of mounted volume c:\volumne_test and make sure it has 1M free space
Sample Command:
CRITICAL: C:: Total: 74.5G - Used: 71.2G (95%) - Free: 3.28G (5%) <critical
Nagios Configuration:
define command {
command_name <<CheckDriveSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MaxWarn=$ARG2$ Ma
}
<<CheckDriveSize>> c:\volumne_test!1M!2M
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckDriveSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a MinWarn=$ARG2$ MinCrit=$A
}
<<CheckDriveSize>> 25%!50%
Check C: 50
Fixed and Network (ignore some)
Check all fixed and network drives but ignore C and F. Not sure about this (should be simpler ways)
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckDriveSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a CheckAllOthers FilterType
}
<<CheckDriveSize>> 25%!50%
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckDriveSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a Drive=x:\ FilterType=REMO
}
<<CheckDriveSize>> x:,90%!95%
Simple Config
Another example for a working config.
Sample Command:
OK: ...
define command {
command_name <<CheckDriveSize>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a Drive=c:\\volumes\\somevo
}
<<CheckDriveSize>> c:\\volumes\\somevolume\,90%!95%
Simple Config 52
CheckFile
A new command to check a bunch of files.
FOr details (if you want to use anyway) refer to the deprecated page.
CheckFile 53
CheckFile2
A command to check aspects on several files it can be used to check one file but that is not the goal. The core
scenario is: "do I have more then x files matching this criteria?" but it is flexible enough to be applicable in
many other scenarios as well.
The main concept is much like the eventlog checks where you have a data-set which you want to "filter" and
then check the resulting number of lines against a criteria.
Syntax
A filter is made up of three things:
Order
Order is important, as soon as a positive (+) or negative (-) rule is matched it is either discarded or included
and the entry is "finished" and it will continue with the next entry. The best way here is to have an "idea"
either remove all entries first or include all required ones first (depending on what you want to do). You can
mix and such but this will probably complicate things for you unless you actually need to.
Filter modes
Capturing files (or discarding them) are done with filters. There are three kinds of filters.
Filter Types
<filter type> Values Description
CheckFile2 54
time expression
A time expression is a date/time interval as a number prefixed by a filter prefix (<, >, =, <>) and followed by
a unit postfix (m, s, h, d, w). A few examples of time expression are: filter+generated=>2d means filter will
match any records older than 2 days, filter+generated=<2h means match any records newer then 2 hours.
Warning, the bash interprets the "<,>,!". Use the "\" to avoid this. e.g. filter+generated=\>2d . On the Client
activate the "Nasty Metachars" Option, to allow the \.
string expression
A string expression is a key followed by a string that specifies a string expression. Currently substr and
regexp are supported. Thus you enter filter.message=regexp:(foo|bar) to enter a regular expression and
filter-message=substr:foo to enter a substring patter match.
Filter in/out
There are two basic ways to filter:
in When you filter in it means all records matching your filter will be returned (the "simplest way")
out When you filter out it means all records matching your filter will be discarded.
So:
filter=in filter+size==5k
...
filter=out filter-size=ne:5k
Will both have the same effect as the first one filters "in" and matches all siles with 5kb and the second one
filters out and discards all files not 5kb.
Sample Command:
ok: CheckFile ok
Nagios Configuration:
define command {
command_name <<CheckFile2>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFile2 -a path=$ARG1$ pattern=*.txt Max
}
<<CheckFile2>> c:\test!2h
time expression 55
CheckEventLog.dll
The CheckEventLog module checks for problems reported to the windows event log.
Configuration Sections
This is a wrapper page the actual data is on the following page CheckEventLog/config
EventLog?
The [EventLog?] section is used by the CheckEventLog module.
Advanced options:
Used to log all information regarding hits and misses on the filtering,. This has sever performance impact as
well as log file will grow so do not use unless you are debugging.
[EventLog]
debug=1
buffer_size
This parameter is set in the nsc.ini file and needs to be put under a heading of [EventLog?] (this heading may
need to be created). The buffer reserves memory each time an eventlog check is being run when so set the size
accordingly (or you will be wasting lots of memory).
To change the default setting of 64KB add (or edit) in the nsc.ini file an entry for buffer size
(buffer_size=512000) where the value is in bytes. Often times the buffer size will need to be increased when
using the %message% variable in return results. Most often you only need to increase this if you get error
reported in the log file from NSClient++
[EventLog]
buffer_size=512000
CheckEventLog.dll 56
Complete configuration
This are the default values for the entire EventLog? section
[EventLog]
debug=0
buffer_size=64000
EventLog? 57
Configuration for the CheckEventLog
This page describes the configuration options for the CheckEventLog module.
This is a wrapper page the actual data is on the following page CheckEventLog/config
Configuration Sections
EventLog?
The [EventLog?] section is used by the CheckEventLog module.
Advanced options:
Used to log all information regarding hits and misses on the filtering,. This has sever performance impact as
well as log file will grow so do not use unless you are debugging.
[EventLog]
debug=1
buffer_size
This parameter is set in the nsc.ini file and needs to be put under a heading of [EventLog?] (this heading may
need to be created). The buffer reserves memory each time an eventlog check is being run when so set the size
accordingly (or you will be wasting lots of memory).
To change the default setting of 64KB add (or edit) in the nsc.ini file an entry for buffer size
(buffer_size=512000) where the value is in bytes. Often times the buffer size will need to be increased when
using the %message% variable in return results. Most often you only need to increase this if you get error
reported in the log file from NSClient++
[EventLog]
buffer_size=512000
Complete configuration
This are the default values for the entire EventLog? section
[EventLog]
EventLog? 59
CheckEventLog
CheckEventLog is part of the wiki:CheckEventLog module. This page describes the new syntax, for the old
syntax refer to the old page: CheckEventLogOld The new syntax is a bit sketchy in the docs as of yet... I shall
try to fix some better examples.. but the best idea would be for someone that uses this to help me with that :)
Before you start using CheckEventLog use this command (it is long but a good place to start):
This check enumerates all event in the event log and filters out (or in) events and then the resulting list is used
to determine state.
Syntax
A filter is made up of three things:
CheckEventLog 60
Filter type What the filter will match (ie. which field).
An Expression What to check for.
Order
Order is important, as soon as a positive (+) or negative (-) rule is matched it is either discarded or included
and the entry is "finished" and it will continue with the next entry. The best way here is to have an "idea"
either remove all entries first or include all required ones first (depending on what you want to do). You can
mix and such but this will probably complicate things for you unless you actually need to.
Filter modes
Capturing eventlog entries (or discarding them) are done with filters. There are three kinds of filters.
other example to simplify it: if for example you want to monitor all errors and to ignore warning and success
in the eventlog you can write the following: filter+severity==error filter-severity==success
filter-severity==informational
and the command with those parameters with others can be like the following: CheckEventLog
file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d
filter+severity==error filter-severity==success filter-severity==informational truncate=1023 unique
descriptions "syntax=%severity%: %source%: %message% (%count%)"
Filter Types
<filter
Values Description
type>
An event type to filter out: error, warning, info, auditSuccess or
eventType event type expression auditFailure. Note that unlike other commands, this requires '==', for
example filter-eventType==info. The info,error, etc are all case sensitive.
The name of the source of the event. Can be a substring or
eventSource string-expression
regularexpression
generated time-expression Time ago the message was generated
written time-expression Time ago the message was written to the log
message string-expression Filter strings in the message. Can be a substring or regularexpression
Syntax 61
eventID numeric-expression Filter based on the event id of the log message.
event severity
severity Filter based on event severity. (filter-severity==warning)
expression
event type expression
An event type expression is similar to a numeric-expression but instead of a number a "keyword" is taken:
error, warning, info, auditSuccess, auditFailure. So filter.eventType==warning or
filter.eventType=<>warning are examples of event type expressions. Yes this is correct the syntax is:
filter<mode><type>=<expression> in this case <mode> is ".", <type> is "eventType" and <expression> is
"<>warning". This IS confusing but it is "simpler to parse" some day maybe I shall improve this.
filter<key><
time expression
A time expression is a date/time interval as a number prefixed by a filter prefix (<, >, =, <>) and followed by
a unit postfix (m, s, h, d, w). A few examples of time expression are: filter+generated=>2d means filter will
match any records older than 2 days, filter+generated=<2h means match any records newer then 2 hours.
Warning, the bash interprets the "<,>,!". Use the "\" to avoid this. e.g. filter+generated=\>2d . On the Client
activate the "Nasty Metachars" Option, to allow the \.
string expression
A string expression is a key followed by a string that specifies a string expression. Currently substr and
regexp are supported. Thus you enter filter.message=regexp:(foo|bar) to enter a regular expression and
filter-message=substr:foo to enter a substring patter match.
Filter in/out
There are two basic ways to filter:
in When you filter in it means all records matching your filter will be returned (the "simplest way")
out When you filter out it means all records matching your filter will be discarded.
So:
filter=in filter+eventType==warning
...
filter=out filter-eventType==warning
Will both have the same effect as the first one filters "in" and matches all warnings and the second one filters
out and discards all warnings. There is one very fundamental difference though the first one will only return
the warnings where as the second one will return all entries and all warnings.
Filter Types 62
Unique
When unique is present any duplicate entries matching the filter will be discarded so you will only get back
one of each "kind" of error. Uniqueness is determined by log-file, event-id, event-type and event-category.
Examples
Sample Eventlog Command
Check by EventID for target errors that may have transpired over the past 2 hours.
$ARG1$ = file to check ie. Application, Security, System
$ARG2$ = Max Warn amount
$ARG3$ = Max Critical amount
$ARG4$ = eventID Number
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckEventLog>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckEventLog -a filter=new file="$ARG1$" M
Another sample
Check the Application event log for errors over the past 48 hours. Filter out any Cdrom and NSClient Errors
as well as all Warnings. Allow 3 target Errors before firing a Warning, and 7 Errors before firing a Critical
State.
Nagios Configuration:
define command {
command_name <<CheckEventLog>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckEventLog -a filter=new file=system fil
}
<<CheckEventLog>>
Unique 63
From Commandline (with NRPE):
Please note: You need to allow_nasty_meta_chars=1 in the NSC.ini to use time filters like "<2d" (last
48 hours).
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckEventLog>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckEventLog -a filter=new file=applicatio
}
<<CheckEventLog>>
Another sample 64
CheckSystem.dll
A module to check various system related things. A list of the modules and there potential use is listed below
here.
Command Line
To simplify debug and setup there is two commandline options that list and test all avalible PDH counters.
Configuration Sections
CheckSystem Section
This is a wrapper page the actual data is on the following page CheckSystem/config
1. 1. 1. 1. Overview
1. CPUBufferSize
2. CheckResolution?
3. auto_detect_pdh
4. dont_use_pdh_index
5. force_language
6. ProcessEnumerationMethod?
7. check_all_services[<key>]
8. MemoryCommitLimit?
9. MemoryCommitByte?
10. SystemSystemUpTime?
11. SystemTotalProcessorTime?
12. debug_skip_data_collection
Overview
The configuration for the CheckSystsem? module should in most cases be automagically detected on most
versions of windows (if you have a problem with this let me know so I can update it). Thus you no longer
need to configure the advanced options. There is also some other tweaks that can be configured such as check
resolution and buffer size.
CheckSystem.dll 65
Option Default value Description
CPUBufferSize 1h The time to store CPU load data.
CheckResolution? 10 Time between checks in 1/10 of seconds.
Advanced options:
The time to store CPU load data. The larger the buffer the more memory is used. This is a time value which
takes an optional suffix for which time denominator to use:
Suffix Meaning
s second
m minutes
h|hour
d day
Default
1h
CheckResolution?
Default
10
auto_detect_pdh
Set this to 0 to disable auto detect (counters.defs) PDH language and OS version.
CheckSystem Section 66
Values
Value Meaning
0 Don't attempt automagically detect the counter names used.
1 Use various menthods to figure out which counters to use.
Default
1
dont_use_pdh_index
When autodetecting counter names do NOT use index to figure out the values.
Values
Value Meaning
0 Use indexes to automagically detect the counter names used.
1 Do NOT use indexes to figure out which counters to use.
Default
0
force_language
When index detection fails your local is used. Here you can override the default local to force another one if
the detected local is incorrect.
Values
Any locale string like SE_sv (not sure here haven't used in years)
Deafult
Empty string which means the system local will be used.
ProcessEnumerationMethod?
DEPRECATED Set the method to use when enumerating processes PSAPI, TOOLHELP or auto No longer
used (only PSAPI is supported).
check_all_services[<key>]
When using check all in a service check the default behaviour is that service set to auto-start should be started
and services set to disabled should be stopped. This can be overridden using this option. Keys avalible:
CheckSystem Section 67
MemoryCommitLimit?
Default
\Memory\Commit Limit
MemoryCommitByte?
Default
\Memory\Committed Bytes
SystemSystemUpTime?
Default
\System\System Up Time
SystemTotalProcessorTime?
Default
\Processor(_total)\% Processor Time
debug_skip_data_collection
Default
0
CheckSystem Section 68
Configuration for the CheckSystem
This page describes the configuration options for the CheckSystem module.
CheckSystem Section
This is a wrapper page the actual data is on the following page CheckSystem/config
1. 1. 1. 1. Overview
1. CPUBufferSize
2. CheckResolution?
3. auto_detect_pdh
4. dont_use_pdh_index
5. force_language
6. ProcessEnumerationMethod?
7. check_all_services[<key>]
8. MemoryCommitLimit?
9. MemoryCommitByte?
10. SystemSystemUpTime?
11. SystemTotalProcessorTime?
12. debug_skip_data_collection
Overview
The configuration for the CheckSystsem? module should in most cases be automagically detected on most
versions of windows (if you have a problem with this let me know so I can update it). Thus you no longer
need to configure the advanced options. There is also some other tweaks that can be configured such as check
resolution and buffer size.
The time to store CPU load data. The larger the buffer the more memory is used. This is a time value which
takes an optional suffix for which time denominator to use:
Suffix Meaning
s second
m minutes
h|hour
d day
Default
1h
CheckResolution?
Default
10
auto_detect_pdh
Set this to 0 to disable auto detect (counters.defs) PDH language and OS version.
Values
Value Meaning
0 Don't attempt automagically detect the counter names used.
1 Use various menthods to figure out which counters to use.
Default
1
dont_use_pdh_index
When autodetecting counter names do NOT use index to figure out the values.
Values
Value Meaning
0 Use indexes to automagically detect the counter names used.
1 Do NOT use indexes to figure out which counters to use.
Overview 70
Default
0
force_language
When index detection fails your local is used. Here you can override the default local to force another one if
the detected local is incorrect.
Values
Any locale string like SE_sv (not sure here haven't used in years)
Deafult
Empty string which means the system local will be used.
ProcessEnumerationMethod?
DEPRECATED Set the method to use when enumerating processes PSAPI, TOOLHELP or auto No longer
used (only PSAPI is supported).
check_all_services[<key>]
When using check all in a service check the default behaviour is that service set to auto-start should be started
and services set to disabled should be stopped. This can be overridden using this option. Keys avalible:
Default
\Memory\Commit Limit
MemoryCommitByte?
Default
\Memory\Committed Bytes
SystemSystemUpTime?
Default
\System\System Up Time
Overview 71
SystemTotalProcessorTime?
Default
\Processor(_total)\% Processor Time
debug_skip_data_collection
Default
0
Overview 72
CheckCPU
CheckCPU is part of the wiki:CheckSystem module.
This check calculates an average of CPU usage for a specified period of time. The data is always collected in
the background and the size and interval is configured from the CPUBufferSize and CheckResolution?
options. A request has one or more options described in the table below.
Configuration
The size and frequency of sampled CPU data can be configured and for details refer to the configuration
section for the CheckSystem module
FAQ
Q: "NSClient - ERROR: Could not get data for 60 perhaps we don"t collect data this far back?"
A: See the configuration section on how to configure the "CPUBufferSize" it has to be LARGER then
your collection time here.
Examples
Sample Command
Check that the CPU load for various times is below 80%:
Sample Command:
Nagios Configuration:
CheckCPU 73
define command {
command_name <<CheckCPU>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCPU -a warn=$ARG1$ crit=$ARG2$ time=20
}
<<CheckCPU>> 80!90
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckCPU>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCPU -a warn=2 crit=$ARG1$ time=5m time
}
<<CheckCPU>> 80
check_load
Check CPU load with intervals like known from Linux/Unix (with example thresholds):
Sample Command:
CheckCPU warn=100 crit=100 time=1 warn=95 crit=99 time=5 warn=90 crit=95 time=15
OK: ...
Nagios Configuration:
define command {
command_name <<CheckCPU>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCPU -a warn=100 crit=100 time=1 warn=9
}
<<CheckCPU>>
check_nrpe -H IP -p 5666 -c CheckCPU -a warn=100 crit=100 time=1 warn=95 crit=99 time=5 warn=90 c
Sample Command 74
CheckUpTime
This check checks the uptime of a server and if the time is less then the times given as arguments a state is
returned.
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckUpTime>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckUpTime -a MinWarn=$ARG1$ MinCrit=$ARG2
}
<<CheckUpTime>> 1d!12h
CheckUpTime 75
CheckServiceState
This check checks the state of one or more service on the system and generates a critical state if any service is
not in the required state.
Examples
Sample check
Check that myService is running and that MyStoppedService? is not running:
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a ShowAll $ARG1$ $ARG2$=
}
<<CheckServiceState>> myService!MyStoppedService
Auto started
Check that all auto-start services are running but exclude some that are intentionaly not in the correct state:
CheckServiceState 76
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a CheckAll exclude=$ARG1
}
<<CheckServiceState>> wampmysqld!MpfService
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a CheckAll exclude=$ARG1
}
<<CheckServiceState>> wampmysqld!NetBackup SAN Client Fibre Transport Service
Auto started 77
CheckProcState
This check checks the state of one or more processes on the system and generates a critical state if any process
is not in the required state.
Please remember that for each external alias there's a command declared (under NSCA command or NRPE
command sections ? depends what you're working with) that uses the external alias declared.
The command also need to have identical name to the value defined for that service check in the Nagios linux
server (usually windows.cfg file and service_description field in define Service block).
Let's start with a simple one ? check that a file named NameOfMonitoredFileReplaceWithYours?.exe is
running (aka in started state in the windows machine).
In the [External Alias] section in the nsc.ini file there's an alias that looks like this:
alias_process=checkProcState $ARG1$=started
so we will leave it and we just have to supply it with our file name as an argument.
We will need to add the following line to the command section (NRPE command section if that's what you are
working with).
NEED_TO_COMPLETE_EXAMPLE_HERE_BY_MICKEM_STAY_TUNED
NSCA is all client side, so if you're working with NSCA you cant use arguments and probably the following
line (without the alias section) will be good for you: Check Process=CheckProcState
CheckProcState 78
NameOfMonitoredFileReplaceWithYours?.exe=started
again, Check Process is the name declared in Nagios server and it has to be the same.
Examples
Process running/not running
Check that quake.exe is not running and NSClient++.exe is running:
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckProcState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a ShowAll $ARG1$=stopped $A
}
<<CheckProcState>> quake.exe!NSClient++.exe
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckProcState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a $ARG1$=stopped $ARG2$=sta
}
<<CheckProcState>> quake.exe!NSClient++.exe
Examples 79
Check number of processes running
make sure that atleast 50 instance of svchost.xe is running.
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckProcState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a MinCritCount=50 $ARG1$=st
}
<<CheckProcState>> svchost.exe
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckProcState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a match=regexp cmdLine Show
}
<<CheckProcState>> printloop
Sample Command:
OK: ...
define command {
command_name <<CheckProcState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a MaxWarnCount=$ARG2$ MaxCr
}
<<CheckProcState>> notepad.exe!4!10
Type Meaning
The maximum amount of memory the current process can commit, in bytes. This value is equal to or
page
smaller than the system-wide available commit value.
paged System-wide committed memory limit (same as used in NSCLient, ie. via PDH, available on NT4)
Number of pages of swap currently in use (note - it does NOT = (physical + swap) as on *nix boxes)
virtual According to M$ this is: Size of unreserved and uncommitted memory in the user mode portion of
the virtual address space of the calling process, in bytes.
The amount of physical memory currently available, in bytes. This is the amount of physical
physical memory that can be immediately reused without having to write its contents to disk first. It is the
sum of the size of the standby, free, and zero lists.
Examples
Page
Check that the page is below 80%:
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$%
}
CheckMem 82
<<CheckMEM>> 80!90
Physical
Check that the physical is below 80%:
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$%
}
<<CheckMEM>> 80!90
Multiple
Check that the physical is below 80%:
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$%
}
<<CheckMEM>> 80!90
Page 83
CheckCounter
Used to check performance counters. This is probably how most things can be checked as there are a lot of
performance counters. To find performance counters, use the program perfmon that is shipped with windows.
You can list all available performance counters using the listpdh option as shown in the examples below.
An important note is that performance counters are language and version specific.
Command line
List all available performance counters, and debug them (means, open, try to read, close, etc)
CheckCounter 84
}
Examples
Sample Command
Check that mutex count (on WinXP) is below 500:
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckCounter>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter:$ARG1$=$ARG2$" Sho
}
<<CheckCounter>> mutex!\\Objects\\Mutexes!500!1000
Using Instances
Using instances in counters
Sample Command:
OK: ...
Nagios Configuration:
define command {
command_name <<CheckCounter>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter:$ARG1$=$ARG2$" Sho
}
<<CheckCounter>> proc!\\Processor(_total)\\% Processor Time!50!80
Nagios Configuration:
define command {
command_name <<CheckCounter>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=$ARG1$" ShowAll Ma
}
<<CheckCounter>> \MSExchangeIS\RPC Operations/sec!300!400
OK: ...
Nagios Configuration:
define command {
command_name <<CheckCounter>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=$ARG1$" ShowAll Ma
}
<<CheckCounter>> \PhysicalDisk(_Total)\% Disk Time!60!90
wiki:CheckAlwaysOK, Alter the return code of another check to always return OK.
wiki:CheckAlwaysCRITICAL, Alter the return code of another check to always return CRITICAL.
wiki:CheckAlwaysWARNING, Alter the return code of another check to always return WARNING.
wiki:CheckMultiple, Runs multiple checks and returns the worst state. Useful for minimizing network
traffic and command definitions.
Configuration
This module has no configuration directives.
CheckHelpers.dll 87
CheckAlwaysOK
Runs another check and alters the return state to always return OK. This command has no options instead
everything is inject as a new command. Notice that this command does not alter the return string so if a check
(as most do) prints WARNING that will still remain, only the return state is altered. The return state is what
Nagios will use to determine state.
Examples
Run the sample check from CheckDisk but alter the return state. Notice that WARNING is still printed, yet
Nagios will interpret this as an OK state.
CheckAlwaysOK 88
CheckAlwaysCRITICAL
Runs another check and alters the return state to always return CRITICAL. This command has no options
instead everything is inject as a new command. Notice that this command does not alter the return string so if
a check (as most do) prints WARNING that will still remain, only the return state is altered. The return state is
what Nagios will use to determine state.
Examples
Run the sample check from CheckDisk but alter the return state. Notice that WARNING is still printed, yet
Nagios will interpret this as a critical state.
CheckAlwaysCRITICAL 89
CheckAlwaysWARNING
Runs another check and alter the return state to always return WARNING. This command has no options
instead everything is inject as a new command. Notice that this command does not alter the return string so if
a check (as most do) prints WARNING that will still remain, only the return state is altered. The return state is
what Nagios will use to determine state.
Examples
Run the sample check from CheckDisk but alter the return state. Notice that WARNING is still printed, yet
Nagios will interpret this as an warning state.
CheckAlwaysWARNING 90
CheckOK
This command always returns "OK".
Examples
CheckOK Hello
OK: Hello
CheckOK 91
CheckCRITICAL
This command always returns "CRITICAL".
Examples
CheckCRITICAL Hello
CRITICAL: Hello
CheckCRITICAL 92
CheckWARNING
This command always returns "WARNING".
Examples
CheckWARNINGHello
WARNING: Hello
CheckWARNING 93
CheckMultiple
Runs multiple checks and returns the worst state. It allows you to check an entire system in one go.
Examples
Run two checks (CheckDriveSize and ChEckMeM) and return the worst state. Performance data and message
is collected and concatenated.
CheckMultiple 94
CheckVersion
This command returns the current version (as a string)
Examples
CheckVersion
OK '0.3.3.20 2008-07-02'
CheckVersion 95
CheckTaskSched.dll
The CheckTaskSched module check check various aspects of the task scheduler. Feel free to request checks
that you need.
Configuration
This module has no configuration directives.
CheckTaskSched.dll 96
CheckTaskSched
CheckTaskSchedis? part of the wiki:CheckTaskSched module.
TODO On some case, NSClient++.exe crash while "CheckTaskSched ShowAll" CheckTaskSched.dll fault at
address 0x00014324 (NSClient++.exe version 20081113-1003)
CheckTaskSched 97
FileLogger.dll
A module that logs all messages to file if no logging module is loaded no error messages will be logged thus it
is hard to find problems.
Configuration Sections
This is a wrapper page the actual data is on the following page FileLogger/config
1. 1. 1. 1. Overview
1. debug
2. file
3. date_mask
4. root_folder
Overview
This section has options for how logging is performed with the [FileLogger] module. 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.
A Boolean value that toggles if debug information should be logged or not. This can be either 1 or 0.
Default
0
Values
Value Meaning
0 Don't log debug messages
1 Log debug messages
file
The file to write log data to. If no directory is used this is relative to the NSClient++ binary.
Default
nsclient.log
FileLogger.dll 98
date_mask
Default
%Y-%m-%d %H:%M:%S
root_folder
Default
exe
Values
The file system directory that contains application data for all users. A typical path is
C:\Documents and Settings\All Users\Application Data. This folder is used for application
local-app-data data that is not user specific. For example, an application can store a spell-check dictionary, a
database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This
information will not roam and is available to anyone using the computer.
exe Location of NSClient++ binary
Overview 99
Configuration for the FileLogger
This page describes the configuration options for the File logging module.
This is a wrapper page the actual data is on the following page FileLogger/config
Configuration Sections
1. 1. 1. 1. Overview
1. debug
2. file
3. date_mask
4. root_folder
Overview
This section has options for how logging is performed with the [FileLogger] module. 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.
A Boolean value that toggles if debug information should be logged or not. This can be either 1 or 0.
Default
0
Values
Value Meaning
0 Don't log debug messages
1 Log debug messages
file
The file to write log data to. If no directory is used this is relative to the NSClient++ binary.
Default
nsclient.log
Default
%Y-%m-%d %H:%M:%S
root_folder
Default
exe
Values
The file system directory that contains application data for all users. A typical path is
C:\Documents and Settings\All Users\Application Data. This folder is used for application
local-app-data data that is not user specific. For example, an application can store a spell-check dictionary, a
database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This
information will not roam and is available to anyone using the computer.
exe Location of NSClient++ binary
Overview 101
NRPEListener.dll
This module accepts incoming NRPE connections and responds by executing various checks and returns their
result. To use this you need to have check_nrpe or another NRPE client. This is similar to check_nt
(NSClient) but much more flexible and supports encryption. This only drawback is that it lacks any
authorization.
As this module has the ability to generate command handlers by configuration there are command handlers
but nothing built in. This is present for compatiblity only it is suggested to use the [CheckExternalScripts]
instead.
Configuration Sections
NRPE Section
This is a wrapper page the actual data is on the following page NRPEListener/config/nrpe
1. 1. 1. 1. Overview
1. port
2. allowed_hosts
3. use_ssl
4. bind_to_address
5. command_timeout
6. allow_arguments
7. allow_nasty_meta_chars
8. socket_timeout
9. script_dir
10. performance_data
11. socket_back_log
12. string_length
Overview
This is configuration for the NRPE module that controls how the NRPE listener operates.
NRPEListener.dll 102
The timeout when reading packets on incoming sockets. If the data has not
socket_timeout 30
arrived within this time we will bail out. and discard the connection.
Advanced options:
Default
5666
allowed_hosts
A list (comma 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
Default
Empty list (falls back to the one defined under [Settings]
use_ssl
Boolean value to toggle SSL (Secure Socket Layer) encryption on the socket connection. This corresponds to
the -n flag in check_nrpe
Values
Value Meaning
0 Don't use SSL
1 Use SSL encryption
Default
1 (enabled)
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
Values
IP address of any interface of the server.
Default
Empty (first (all?) interface will be used)
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 so internal commands may execute forever.
It is usually a good idea to set this to less then the timeout used with check_nrpe
Default
60
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.
NOTICE That there are more then one place to set this!
Default
0 (means don't allow arguments)
Values
Value Meaning
0 Don't allow arguments
1 Allow arguments.
allow_nasty_meta_chars
Allow NRPE execution to have ?nasty? meta characters that might affect execution of external commands
(things like > ? etc).
Default
0 (means don't allow meta characters)
Values
Value Meaning
0 Don't allow meta characters
1 Allow meta characters
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
script_dir
Load all scripts in a directory and use them as commands. Probably dangerous but useful if you have loads of
scripts :)
Default
Empty (don't load any scripts)
performance_data
Send performance data back to Nagios (set this to 0 to remove all performance data)
Default
1
Values
Value Meaning
0 Don't send performance data
1 Send 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_length
Length 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.
Default
1024
1. 1. 1. 1. Ovreview
1. Alias (builtin commands)
2. NRPE_NT Syntax
DEPRECATED This part of the module is deprecated and should not be used. Refer to the
[CheckExternalScripts] module instead. This module can add two types of command handlers.
First there are external command handlers that execute a separate program or script and simply return the
output and return status from that. The other possibility is to create an alias for an internal command.
To add an external command you add a command definition under the ?NRPE Handlers? section. A command
definition has the following syntax:
[NRPE Handlers]
command_name=/some/executable with some arguments
test_batch_file=c:\test.bat foo $ARG1$ bar
command[check_svc]=inject CheckService checkAll
The above example will on an incoming ?test_batch_file? execute the c:\test.bat file and return the output as
text and the return code as the Nagios status.
To add an internal command or alias is perhaps a better word. You add a command definition under the
?NRPE Handlers? section. A command definition with the following syntax:
The above example will on an incoming ?check_cpu? execute the internal command ?checkCPU? with
predefined arguments give in the command definition.
NRPE_NT Syntax
To leverage existing infrastructure you can copy your old definitions from NRPE_NT as-is. Thus the
following:
CheckServcice checkAll
NRPE Section
This is a wrapper page the actual data is on the following page NRPEListener/config/nrpe
1. 1. 1. 1. Overview
1. port
2. allowed_hosts
3. use_ssl
4. bind_to_address
5. command_timeout
6. allow_arguments
7. allow_nasty_meta_chars
8. socket_timeout
9. script_dir
10. performance_data
11. socket_back_log
12. string_length
Overview
This is configuration for the NRPE module that controls how the NRPE listener operates.
Default
5666
allowed_hosts
A list (comma 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
Default
Empty list (falls back to the one defined under [Settings]
use_ssl
Boolean value to toggle SSL (Secure Socket Layer) encryption on the socket connection. This corresponds to
the -n flag in check_nrpe
Values
Value Meaning
0 Don't use SSL
1 Use SSL encryption
Default
1 (enabled)
bind_to_address
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
Values
IP address of any interface of the server.
Default
Empty (first (all?) interface will be used)
Overview 108
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 so internal commands may execute forever.
It is usually a good idea to set this to less then the timeout used with check_nrpe
Default
60
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.
NOTICE That there are more then one place to set this!
Default
0 (means don't allow arguments)
Values
Value Meaning
0 Don't allow arguments
1 Allow arguments.
allow_nasty_meta_chars
Allow NRPE execution to have ?nasty? meta characters that might affect execution of external commands
(things like > ? etc).
Default
0 (means don't allow meta characters)
Values
Value Meaning
0 Don't allow meta characters
1 Allow meta characters
socket_timeout
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
script_dir
Load all scripts in a directory and use them as commands. Probably dangerous but useful if you have loads of
scripts :)
Overview 109
Default
Empty (don't load any scripts)
performance_data
Send performance data back to Nagios (set this to 0 to remove all performance data)
Default
1
Values
Value Meaning
0 Don't send performance data
1 Send 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_length
Length 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.
Default
1024
1. 1. 1. 1. Ovreview
1. Alias (builtin commands)
2. NRPE_NT Syntax
Ovreview
DEPRECATED This part of the module is deprecated and should not be used. Refer to the
[CheckExternalScripts] module instead. This module can add two types of command handlers.
First there are external command handlers that execute a separate program or script and simply return the
output and return status from that. The other possibility is to create an alias for an internal command.
To add an external command you add a command definition under the ?NRPE Handlers? section. A command
definition has the following syntax:
[NRPE Handlers]
command_name=/some/executable with some arguments
test_batch_file=c:\test.bat foo $ARG1$ bar
command[check_svc]=inject CheckService checkAll
Overview 110
The above example will on an incoming ?test_batch_file? execute the c:\test.bat file and return the output as
text and the return code as the Nagios status.
To add an internal command or alias is perhaps a better word. You add a command definition under the
?NRPE Handlers? section. A command definition with the following syntax:
The above example will on an incoming ?check_cpu? execute the internal command ?checkCPU? with
predefined arguments give in the command definition.
NRPE_NT Syntax
To leverage existing infrastructure you can copy your old definitions from NRPE_NT as-is. Thus the
following:
CheckServcice checkAll
Ovreview 111
NSClientListener.dll
The NSClientListener module is written to allow backwards compatibility with the old NSClient and
check_nt. It has a listener (server) that accepts checks from the check_nt command and responds accordingly.
Due to the nature of the protocol and the limitation in the client NRPE is recommended but if you like this
works just fine for "simple things".
CLIENTVERSION
CPULOAD
UPTIME
USEDDISKSPACE
MEMUSE
SERVICESTATE
PROCSTATE
COUNTER
Configuration Sections
NSClient Section
This is a wrapper page the actual data is on the following page NSClientListener/config
1. 1. 1. 1. Ovreview
1. port
2. obfuscated_password
3. password
4. allowed_hosts
5. bind_to_address
6. socket_timeout
7. socket_back_log
8. version
Ovreview
Default
Option Description
value
port 12489 The port to listen to
obfuscated_password An obfuscated version of password.
password The password that incoming client needs to authorize themselves by.
A list (coma separated) with hosts that are allowed to connect to
allowed_hosts
NSClient++ via NSClient protocol.
socket_timeout 30 The timeout when reading packets on incoming sockets.
Advanced options:
NSClientListener.dll 112
Option Default value Description
Number of sockets to queue before starting to refuse new incoming
connections. This can be used to tweak the amount of simultaneous
socket_back_log
sockets that the server accepts. This is an advanced option and
should not be used.
The address to bind to when listening to sockets, useful if you have
bind_to_address more then one NIC/IP address and want the agent to answer on a
specific one.
The version number to return for the CLIENTVERSION check
version auto (useful to "simulate" an old/different version of the client, auto will
be generated from the compiled version string inside NSClient++
port
Default
12489
obfuscated_password
An obfuscated version of password. For more details refer to the password option below.
Default
Empty string whjich means we will use the value from password instead.
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.
Default
Empty string whjich means we will use the value from password in the [Settings] section instead.
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.
Default
Empty list (falls back to the one defined under [Settings]
bind_to_address
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
socket_timeout
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
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.
version
The 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++
Values:
If given any str4ing will be returned unless auto in which case the proper
version will be returned
Default
auto
Examples
Check the size of C:\ and make sure it warns at 80% used and a critical warning at 95% used:
define command {
command_name check_nt_disk
command_line $USER1$/check_nt -s passphrase -H $HOSTADDRESS$ -p 12489
-v USEDDISKSPACE -l $ARG1$ -w $ARG2$ -c $ARG3$
}
check_command check_nt_disk!c!80!95
define command {
command_name check_io_read
command_line /usr/local/nagios/libexec/check_nt -H $HOSTADDRESS$
-v COUNTER -l "\\System\\File Read Bytes/sec"
}
check_command check_io_read
NSClient Section
This is a wrapper page the actual data is on the following page NSClientListener/config
1. 1. 1. 1. Ovreview
1. port
2. obfuscated_password
3. password
4. allowed_hosts
5. bind_to_address
6. socket_timeout
7. socket_back_log
8. version
Ovreview
Default
Option Description
value
port 12489 The port to listen to
obfuscated_password An obfuscated version of password.
password The password that incoming client needs to authorize themselves by.
A list (coma separated) with hosts that are allowed to connect to
allowed_hosts
NSClient++ via NSClient protocol.
socket_timeout 30 The timeout when reading packets on incoming sockets.
Advanced options:
Default
12489
obfuscated_password
An obfuscated version of password. For more details refer to the password option below.
Default
Empty string whjich means we will use the value from password instead.
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.
Default
Empty string whjich means we will use the value from password in the [Settings] section instead.
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.
Default
Empty list (falls back to the one defined under [Settings]
bind_to_address
The address to bind to when listening to sockets. If not specified the "first" (all?) one will be used (often the
correct one).
Values
IP address of any interface of the server.
Default
Empty (first (all?) interface will be used)
socket_timeout
The timeout when reading packets on incoming sockets. If the data has not arrived within this time we will
bail out. and discard the connection.
Default
30 seconds
Ovreview 116
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.
version
The 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++
Values:
If given any str4ing will be returned unless auto in which case the proper
version will be returned
Default
auto
Ovreview 117
SysTray.dll
A simple module to show an icon in the tray when the service is running this module does not export any
check commands.
[Settings]
...
shared_Session=1
For a service to be able to "interact with the desktop" it has to be set to do so. By default (for "security
reasons") it is not enabled so if you want to use this module you need to enable that. The simplest way to do is
to run the following command:
For this to work the service has to have been installed first (ie. "nsclient++ -install").
SysTray.dll 118
CheckWMI.dll
The CheckWMI module has various WMI related functions used to query and check the WMI (Windows
Managment Instrumenation). Feel free to request checks that you need.
CheckWMI, Check large resultsets from (for instance are there more than 5-rows matching criteria X,
ie. more than 5 Internet Explorer processes witch uses more then 123Mb memory).
CheckWMIValue, Check the result of a query (ie. are the current memory utilization over X)
Configuration
This module has no configuration directives.
CheckWMI.dll 119
CheckWMI
CheckWMI is part of the wiki:CheckWMI module.
New version that is *a lot* more usefull (i hope). It is still alpha need to do more testing but I would like to
get some initial feedback on the syntax and such. Also feel free to try it out and report bugs to me (might
wanna keep track of memory and such as I have not done so myself yet) To debug and help you setup your
queries there is also a command line interface to run queries and see the result.
The syntax for this is Similar to CheckEventLog but simpliefied in regards to syntax so I hope it shall be
easier to use and udnerstand.
This check enumerates all rows returned from your query filtering results and check the count against a set
war and crit threshold. If you want to check a value there will soon be a separet check for that. This is
designed to find "anomalies" in result-sets.
None of these filters can match (if any do the row is discarded).
CheckWMI 120
If this matches the line is included.
Filter <Mode>s
<mode> title description
+ required filter If you miss this filter the line is discarded
. normal filter If a hit the line is included
- negative filter If a line hits this it is discarded
Filter <Type>s
<type> Value Description
string [[string expression]] Match the column againast a string expression
numeric [[numeric expression]] Match the column againast a numeric expression
Filter <Columns>s
A Column (if specified) will make the filter woirk againast a specific column in the result set.
string expression
A string expression is a key followed by a string that specifies a string expression. Currently substr and
regexp are supported. Thus you enter filter.message=regexp:(foo|bar) to enter a regular expression and
filter-message=substr:foo to enter a substring patter match.
columnSyntax
The column syntax field can be used to alter the renderd output. It has the following keys (everything else will
be a string):
Key Description
%column% The name of the current column
%value% The value
%<column>% The value of a named column
Examples
A sample query
A not very useful check which serves to illustrate how to use the command. Check to see if there is 2 CPUs
present (or cores)
Sample Command:
Filters 121
WARNING: WARNING:: 1 <warning
Nagios Configuration:
define command {
command_name <<CheckWMI>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMI -a MaxCrit=3 MinWarn=1 "Query=Sele
}
<<CheckWMI>>
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMI>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMI -a MaxCrit=3 MinWarn=1 "Query:cpu=
}
<<CheckWMI>>
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMI>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMI -a MaxCrit=3 MinWarn=1 "Query:cpu=
}
<<CheckWMI>>
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMI>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMI -a CheckWMI MaxCrit=3 MaxWarn=1 "Q
}
<<CheckWMI>>
Debbuging queries
To try a query use the following syntax:
It is still alpha need to do more testing but I would like to get some initial feedback on the syntax and
such. Also feel free to try it out and report bugs to me (might wanna keep track of memory and such as
I have not done so myself yet) To debug and help you setup your queries there is also a command line
interface to run queries and see the result.
The syntax for this is Similar to other check commands so it should be pretty straight forward to set it up. The
plugin will run a WMI query and check the returned columns against bounds provided by the checker (nagios)
and report the result.
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMIValue>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMIValue -a "Query=Select * from win32
CheckWMIValue 124
}
<<CheckWMIValue>>
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMIValue>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMIValue -a "Query=select Caption, Thr
}
<<CheckWMIValue>>
Ping status
Little example on W32_PingStatus, I use this to check my VPN tunnels.
Sample Command:
Nagios Configuration:
define command {
command_name <<CheckWMIValue>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckWMIValue -a 'Query=SELECT StatusCode F
}
<<CheckWMIValue>>
Examples 125
Using from command line
To try a query use the following syntax:
External Script
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_script
1. 1. 1. 1. Ovreview
1. command_timeout
2. allow_arguments
3. allow_nasty_meta_chars
4. script_dir
Ovreview
Configure how the External Scripts module works (not to be confused with the "External Scripts" section
below that holds scripts that can be run.
Default
Option Description
value
command_timeout 60 The maximum time in seconds that a command can execute.
A Boolean flag to determine if arguments are accepted on the command
allow_arguments 0
line.
Allow NRPE execution to have ?nasty? meta characters that might
allow_nasty_meta_chars 0
affect execution of external commands.
When set all files in this directory will be available as scripts.
script_dir
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:
Default
60 (seconds).
Example
Set timeout to 120 seconds
[External Script]
command_timeout=120
CheckExternalScripts.dll 127
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
[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
1. 1. 1. 1. Ovreview
Ovreview
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
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
1. 1. 1. 1. Ovreview
Ovreview
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.
[External Aliases]
alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s
External Script
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_script
1. 1. 1. 1. Ovreview
1. command_timeout
2. allow_arguments
3. allow_nasty_meta_chars
4. script_dir
Ovreview
Configure how the External Scripts module works (not to be confused with the "External Scripts" section
below that holds scripts that can be run.
Default
Option Description
value
command_timeout 60 The maximum time in seconds that a command can execute.
A Boolean flag to determine if arguments are accepted on the command
allow_arguments 0
line.
Allow NRPE execution to have ?nasty? meta characters that might
allow_nasty_meta_chars 0
affect execution of external commands.
When set all files in this directory will be available as scripts.
script_dir
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:
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
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]
Ovreview 132
script_dir=.\scripts\*.bat
External Scripts
This is a wrapper page the actual data is on the following page CheckExternalScripts/config/external_scripts
1. 1. 1. 1. Ovreview
Ovreview
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
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
1. 1. 1. 1. Ovreview
Ovreview
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.
[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
Configuration
[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
This is just a quick intro, I will try to add more info here and also try to add more system related functions
(like WMI and performance counter access) in the future.
LUAScript.dll 134
Debugging Lua
Use the print statement to print to the console (can bee sen from nsclient++ /test).
nscp.register('lua_debug', 'debug')
nsclient++ /test
...
lua_debug Greetings
...
d \nsclient++.cpp(540) Injecting: lua_debug: Greetings
Hello world: lua_debug
e \script_wrapper.hpp(280) No arguments returned from script.
l \nsclient++.cpp(575) No handler for command: 'lua_debug'
nscp.register('command_alias', 'function_in_lua_to_use');
This will when the command command_alias is run execute the function_in_lua_to_use in your script. You
can have as many commands as you like so the following is possible:
nscp.register('lua_1', 'lua_function_1');
nscp.register('lua_2', 'lua_function_2');
nscp.register('lua_3', 'lua_function_3');
nscp.register('lua_4', 'lua_function_4');
nscp.register('lua_5', 'lua_function_5');
As of now there are no support for arguments but in the future they will be added. Printing from a
check_function is useless (apart from debug) so generally don't do that. The return is a variable list If;
3 options are returned they are assumed to be in order: code, message and performance data
2 options are returned they are assumed to be in order: code, message
1 options are returned they are assumed to be in order: code
crit (critical)
warn (warning)
ok (ok)
error (critical)
Configuration
This page describes the configuration options for the NSCA module.
1. 1. 1. 1. Ovreview
1. interval
2. nsca_host
3. nsca_port
4. encryption_method
5. password
6. hostname
7. debug_threads
Ovreview
Default
Option Description
value
Time in seconds between each report back to the server (cant as of yet be set
interval 60
individually so this is for all "checks")
nsca_host ... The NSCA/Nagios(?) server to report results to.
nsca_port 5667 The NSCA server port
Number corresponding to the various encryption algorithms (see below). Has
encryption_method 1
to be the same as the server or it wont work at all.
The password to use. Again has to be the same as the server or it won't work
password
at all.
Advanced options:
Time in seconds between each report back to the server (cant as of yet be set individually so this is for all
"checks")
NSCAAgent.dll 139
Value
Any positive integer (time in seconds)
Default
60 (seconds)
nsca_host
Values
Hostname or IP address to submit back results to.
Default
Empty string (will in 3.7 and above mean don't submit results)
nsca_port
Values
Any positive integer (port number ought to be less then 65534)
Default
5667
encryption_method
Number corresponding to the various encryption algorithms (see below). Has to be the same as the server or it
wont work at all.
Values
# Algorithm
0 None (Do NOT use this option)
1 Simple XOR (No security, just obfuscation, but very fast)
2 DES
3 3DES (Triple DES)
4 CAST-128
6 xTEA
8 BLOWFISH
9 TWOFISH
11 RC2
14 RIJNDAEL-128 (AES)
20 SERPENT
Default
1 (I am note sure I thought default was 14?)
The password to use. Again has to be the same as the server or it won't work at all.
Values
Any string (should be the same as the one configured in nsca.conf
hostname
The host name of this host if set to blank (default) the windows name of the computer will be used.
Values
Any string (or auto)
Default
auto (means windows hostname will be used)
debug_threads
DEBUGNumber of threads to run, no reason to change this really (unless you want to stress test something)
Values
Any positive integer larger then or equal to 1
Default
1
1. 1. 1. 1. Overview
Overview
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 have no service name).
[NSCA Commands]
my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4
host_check=check_ok
1. 1. 1. 1. Ovreview
1. interval
2. nsca_host
3. nsca_port
4. encryption_method
5. password
6. hostname
7. debug_threads
Ovreview
Default
Option Description
value
Time in seconds between each report back to the server (cant as of yet be set
interval 60
individually so this is for all "checks")
nsca_host ... The NSCA/Nagios(?) server to report results to.
nsca_port 5667 The NSCA server port
Number corresponding to the various encryption algorithms (see below). Has
encryption_method 1
to be the same as the server or it wont work at all.
The password to use. Again has to be the same as the server or it won't work
password
at all.
Advanced options:
Time in seconds between each report back to the server (cant as of yet be set individually so this is for all
"checks")
Value
Any positive integer (time in seconds)
Default
60 (seconds)
Values
Hostname or IP address to submit back results to.
Default
Empty string (will in 3.7 and above mean don't submit results)
nsca_port
Values
Any positive integer (port number ought to be less then 65534)
Default
5667
encryption_method
Number corresponding to the various encryption algorithms (see below). Has to be the same as the server or it
wont work at all.
Values
# Algorithm
0 None (Do NOT use this option)
1 Simple XOR (No security, just obfuscation, but very fast)
2 DES
3 3DES (Triple DES)
4 CAST-128
6 xTEA
8 BLOWFISH
9 TWOFISH
11 RC2
14 RIJNDAEL-128 (AES)
20 SERPENT
Default
1 (I am note sure I thought default was 14?)
password
The password to use. Again has to be the same as the server or it won't work at all.
Values
Any string (should be the same as the one configured in nsca.conf
Ovreview 143
hostname
The host name of this host if set to blank (default) the windows name of the computer will be used.
Values
Any string (or auto)
Default
auto (means windows hostname will be used)
debug_threads
DEBUGNumber of threads to run, no reason to change this really (unless you want to stress test something)
Values
Any positive integer larger then or equal to 1
Default
1
1. 1. 1. 1. Overview
Overview
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 have no service name).
[NSCA Commands]
my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4
host_check=check_ok
Ovreview 144