Nagios Checks on Microsoft Counters

From Nagios Wiki

Jump to: navigation, search

[edit] NC_net


   Custom Counter

Syntax: check_nt -H HOSTNAME -v COUNTER -l counter_name[,counter_description] [-w warning_percent ] [-c critical_percent]

counter_name is the exact description of the Windows counter. Is must be enclosed in " and the \ should be doubled.
counter_description is the description which is displayed in the "Service Information" column. This string is passed to a printf command, which means that you need to give a precise and specific syntax to make it work. Have a look at any printf reference to get the full story about this C command.
Here are some examples:
"Paging file usage is %.2f %%" (the %.2f means that the result will be displayed with two decimal digits. The double % represents a % in the printf syntax.
"%.f %% of the paging file used" (the %.f means that the result will be displayed with no decimal digit.
warning_percent and critical_percent : thresholds between 1 and 100. If warning_percent is higher than critical_percent, the check is reversed.
Check_nt send Buffer: password&8&Counter_to_check&CounterDescription
- the counter description is used by Check_nt and is not expected or used by NC_Net
Check_nt receive Buffer: decimal_counter_value
- a decimal value is returned by NC_Net
- 5 decimal places are retuned

error returns to Check_nt:
-1&No Counter to check (if less than three arguments sent to NC_Net)
-1&Could not process check counter (if the Performance counter check failed for any reason.)

Details of CHECK_NT results:
IF warning equals critical and less then result then OK
Else If warning equals critical and greater than or equal result then CRITICAL
Else If could not find Counter then result is -1 plug in returns OK -no Unknown for check
Else If warning less than Critical and critical less than or equal result then critical
Else If warning less than Critical and warning less than or equal result then Warning
Else If warning less than critical and result less than warning than OK
Else If critical less than warning and result less than or equal critical then Critical
Else If critical less than warning and result less than or equal warning then Warning
Else If critical less than warning and result greater than warning then OK

Example:
./check_nt -H 192.168.1.1 -p 1248 -v COUNTER -l "\\Paging File(_Total)\\%% Usage","Paging file usage is %.2f %%" -w 80 -c 90
./check_nt -H 192.168.1.1 -p 1248 -v COUNTER -l "\\Process(_Total)\\Thread Count","Thread Count: %.f" -w 600 -c 800
./check_nt -H 192.168.1.1 -p 1248 -v COUNTER -l "\\Server\\Server Sessions","Server Sessions: %.f" -w 20 -c 30
Instances

Syntax: check_nt -H HOSTNAME -v INSTANCES -l Category_object[,Category_object2]

Category_object is a Windows Performance Counter Categroy (e.g.. Process), if it is two words, it should be enclosed in quotes
The returned results will be a comma-separated list of instances on the selected Category.
accept comma separated list of categories to check.
Old NS_client called the Categories - Perfmon Counter Objects. (categories is used in Dot NET Documentation)
The purpose of this is to be run from command line to determine what instances are available for monitoring without having to log onto the Windows server to run Perfmon directly.
Check_nt send Buffer: password&10&Category&Category
NC_Net can check multiple categories
Categories are not case sensitive
Check_nt receive Buffer: String of descriptive results.
Basic output is the category name colon comma separated list of instances.
if no instances then the list is empty.
Categories outputs are delimted with a dash - in the output.
If a Category does not exist it will also list an empty list.
Output String Format:
Cat1: inst1,inst2,inst3 - cat2: inst1,inst2

Example
./check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process

[edit] Microsoft Resources on Windows Counters

Personal tools
Advertisement