Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check Windows Performance Monitor Counters
2.0.0
2022-02-20
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
GPL
19976
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
It checks value of performance counters based on thresholds specified and returns exit and performance data in Nagios format.
Plugin for Icinga/Nagios that allow to check a group of Windows performance counters specified in a XML file.
Check out on GitHub for more detailed information:
https://github.com/juangranados/check_win_perfmon
Checks value of performance counter based on threshold specified.
Returns exit and performance data in Icinga/Nagios format.
Release 2.0 has breaking changes with 1.4. You must change 'auto' parameter in xml files for 'automemory', 'autodisk' or 'autonetwork'
Please read below before use it!
-----------------------
Preconfigured XML files
-----------------------
In downloaded zip package, there are several .xml files preconfigured:
* PerfMonNetwork.xml: Performance Counters to check network load.
* PerfMonPhysicalDisk.xml:Performance Counters to check physical Disk load.
* PerfMonCPU.xml: Performance Counters to check CPU load.
* PerfMonMem.xml: Performance Counters to check Memory (RAM and virtual) load.
* PerfMonMSQL.xml: Performance Counters to check Microsoft SQL Server.
* PerfMonWebService.xml: Performance Counters to check Microsoft IIS Web Service.
* PerfMonPrinter.xml: Performance Counters to check Microsoft Print Server.
* PerfMonCB.xml: Performance Counters to check Microsoft Connection Broker Server and its WID.
* PerfMonHyperV.xml: Performance Counters to check Microsoft Hyper-V Server.
* PerfMonWID.xml: Performance Counters to check Microsoft Windows Internal Database of WSUS.
------
Usage
------
check_win_perfmon.exe [parameters]:
* -f, --xmlFile (Default: perfcounts.xml) XML file with performance counters configuration.
* -s, --maxSamples (Default: 3) Amount of samples to take from perfmon.
* -t, --timeSamples (Default: 1000) Time between samples in ms.
* -n, --noalerts (Default: false) Always returns 0. Useful to get only performance data without alerts.
* -p, --xmlParams (Default: none) Array of params to change in xml file. Read below for examples.
* -v, --verbose Verbose output for debuging.
Check performance counters of PerfMonMem.xml taking 10 samples with 2 sec interval.
check_win_perfmon.exe -f PerfMonMem.xml -s 10 -t 2000
----------
Examples
---------
Example CPU counters: check_win_perfmon.exe -f PerfMonCPU.xml
OK - All performance counters between range | 'ProcessorTime'=3%;95;100;0;100 'UserTime'=2%;85;95;0;100 'DPCTime'=0%;15;20;0;100 'InterruptTime'=0%;10;15;0;100 'ProcessorQueueLength'=0;4;8;;
Example Memory counters: check_win_perfmon.exe -f PerfMonMem.xml
OK - All performance counters between range | 'CommittedBytesInUse'=57%;80;90;0;100 'AvailableMBytes'=4083MB;1024;512;0;8192 'AvailableMBytesPercent'=50%;13;6;0;100 'FreeSystemPageTableEntries'=2867405056;5000;4000;; 'PagesSec'=0;5000;6000;;
Example Physical Disk counters: check_win_perfmon.exe -f PerfMonPhysicalDisk.xml
OK - All performance counters between range | 'AvgDiskSecTransfer'=0.0002s;0.04;0.05;; 'CurrentDiskQueueLength'=0;32;40;; 'AvgDiskSecWrite'=0.0002s;0.04;0.05;0; 'AvgDiskSecRead'=0s;0.04;0.05;0; 'IdleTime'=100%;20;15;0;100
Example Network counters: check_win_perfmon.exe -f PerfMonNetwork.xml
OK - All performance counters between range | 'BytesTotalSec'=1885.7051B;15728640;17825790;0;20971520 'BytesTotalSecPercent'=0%;75;85;0;100 'OutputQueueLength'=0;2;3;;
Example Microsoft SQL counters: check_win_perfmon.exe -f PerfMonMSQL.xml
OK - All performance counters between range | 'TotalServerMemory'=8381528KB;14680060;16252930;0;16777220 'TotalServerMemoryPercent'=50%;88;97;0;100 'TargetServerMemory'=8388608KB;14680060;16252930;0;16777220 'TargetServerMemoryPercent'=50%;88;97;0;100 'PageReadsSec'=0;90;100;; 'PageWritesSec'=0;90;100;; 'BufferCacheHitRatio'=100;95;90;0;100 'BufferCacheHitRatioPercent'=100%;95;90;0;100 'PageLifeExpectancy'=109982.6641;400;300;; 'LazyWritesSec'=0;15;20;; 'FreeListStallsSec'=0;1;2;; 'MemoryGrantsPending'=0;1;2;; 'BatchRequestsSec'=16.6571;1000;2000;; 'UserConnections'=115.3333;600;700;; 'LockWaitsSec'=0;1;2;; 'ProcessesBlocked'=0;1;2;;
-----------------------------------------------------------------
Creating new XML files to check your own performance counters
-----------------------------------------------------------------
You can set up your own performance counters adding them to xml files or creating new ones.
To list available performance counters on a system in a PowerShell console type:
PowerShell
# Get all counters
Get-Counter -ListSet * | Select-Object -ExpandProperty Counter
# Get specified counter
Get-Counter -ListSet *processor* | Select-Object -ExpandProperty Counter
You can check performance counters on a Windows system: Start Menu->Administrative Tools->Performance Monitor->Clic on plus symbol
XML Format
------------
XML file used must have the following format, for example:
(Check GitHub for example)
Warning: Counter names must be in english.
In the example above, program will check two counters. For each counter, we need to set:
* category: Category of performance counter
* name: Name of the performance counter.
* instance: Instance of performance counter. Some performance counter does not have instance, in this case the value must be: none.
* autonetwork: detects main network interface.
* autodisk: detect system disk.
* friendlyname: name of performance counter which program returns in performance output.
* units: units program returns in performance output.
* warning: Warning threshold for performance counter.
* critical: Critical threshold for performance counter.
* min: minimum value of performance counter. If you do not know the minimum value, it has to be: none.
* max: maximum value of performance counter. If you do not know the maximum value, it has to be: none.
* autonetwork: detects network interface speed in kb/s.
* automemory: detects system memory.
If max and min are specified, program returns one more performance result for calculated percent value.
Max and min must have different value.
If you want to check only warning or critical threshold, it should have the format: lt or gt, and none for not checked one.
For example, warning if counter is less or equal than 15:
(Check GitHub for example)
Critical if counter is greater or equal than 90% of max:
(Check GitHub for example)
----------------------
XML with parameters
----------------------
To avoid creating an xml file for each network interface, disk or sql instance, we can create a generic xml file with parameters, for example.
(Check GitHub for example)
To pass parameters:
check_win_perfmon.exe -f PerfMonNetworkParams.xml -p "Interface 1" "1" "2" "Interface 2" "5"
Params of type {n} will be replaced in order.
XML file would be:
(Check GitHub for example)
You can use two parĂ¡meters in same field too.
(Check GitHub for example)
To check it:
check_win_perfmon.exe -f PerfMonDiskParams.xml -p "1" "D"
check_win_perfmon.exe -f PerfMonDiskParams.xml -p "3" "F"
-------------
System Load
-------------
I tried to minimize system load during program execution, but check performance counters allways has an impact on system performance. Program execution has a 5% of CPU usage on old systems and a minimun impact on modern servers. The more performance counters you check at a time, the more system impact.
-------------
References
-------------
Values and counters are based on System Center Operations Manager checkins. You can check it out http://mpwiki.viacode.com/default.aspx?g=posts&t=219816.
Values and counters for Microsoft SQL are based on articles from https://www.sqlshack.com/sql-server-memory-performance-metrics-part-1-memory-pagessec-memory-page-faultssec/ and http://www.databasejournal.com/features/mssql/article.php/3932406/Top-10-SQL-Server-Counters-for-Monitoring-SQL-Server-Performance.htm.
Updated tresholds based on the amazing tool https://github.com/clinthuffman/PAL created by Clint Huffman from Microsoft.
Check out on GitHub for more detailed information:
https://github.com/juangranados/check_win_perfmon
Checks value of performance counter based on threshold specified.
Returns exit and performance data in Icinga/Nagios format.
Release 2.0 has breaking changes with 1.4. You must change 'auto' parameter in xml files for 'automemory', 'autodisk' or 'autonetwork'
Please read below before use it!
-----------------------
Preconfigured XML files
-----------------------
In downloaded zip package, there are several .xml files preconfigured:
* PerfMonNetwork.xml: Performance Counters to check network load.
* PerfMonPhysicalDisk.xml:Performance Counters to check physical Disk load.
* PerfMonCPU.xml: Performance Counters to check CPU load.
* PerfMonMem.xml: Performance Counters to check Memory (RAM and virtual) load.
* PerfMonMSQL.xml: Performance Counters to check Microsoft SQL Server.
* PerfMonWebService.xml: Performance Counters to check Microsoft IIS Web Service.
* PerfMonPrinter.xml: Performance Counters to check Microsoft Print Server.
* PerfMonCB.xml: Performance Counters to check Microsoft Connection Broker Server and its WID.
* PerfMonHyperV.xml: Performance Counters to check Microsoft Hyper-V Server.
* PerfMonWID.xml: Performance Counters to check Microsoft Windows Internal Database of WSUS.
------
Usage
------
check_win_perfmon.exe [parameters]:
* -f, --xmlFile (Default: perfcounts.xml) XML file with performance counters configuration.
* -s, --maxSamples (Default: 3) Amount of samples to take from perfmon.
* -t, --timeSamples (Default: 1000) Time between samples in ms.
* -n, --noalerts (Default: false) Always returns 0. Useful to get only performance data without alerts.
* -p, --xmlParams (Default: none) Array of params to change in xml file. Read below for examples.
* -v, --verbose Verbose output for debuging.
Check performance counters of PerfMonMem.xml taking 10 samples with 2 sec interval.
check_win_perfmon.exe -f PerfMonMem.xml -s 10 -t 2000
----------
Examples
---------
Example CPU counters: check_win_perfmon.exe -f PerfMonCPU.xml
OK - All performance counters between range | 'ProcessorTime'=3%;95;100;0;100 'UserTime'=2%;85;95;0;100 'DPCTime'=0%;15;20;0;100 'InterruptTime'=0%;10;15;0;100 'ProcessorQueueLength'=0;4;8;;
Example Memory counters: check_win_perfmon.exe -f PerfMonMem.xml
OK - All performance counters between range | 'CommittedBytesInUse'=57%;80;90;0;100 'AvailableMBytes'=4083MB;1024;512;0;8192 'AvailableMBytesPercent'=50%;13;6;0;100 'FreeSystemPageTableEntries'=2867405056;5000;4000;; 'PagesSec'=0;5000;6000;;
Example Physical Disk counters: check_win_perfmon.exe -f PerfMonPhysicalDisk.xml
OK - All performance counters between range | 'AvgDiskSecTransfer'=0.0002s;0.04;0.05;; 'CurrentDiskQueueLength'=0;32;40;; 'AvgDiskSecWrite'=0.0002s;0.04;0.05;0; 'AvgDiskSecRead'=0s;0.04;0.05;0; 'IdleTime'=100%;20;15;0;100
Example Network counters: check_win_perfmon.exe -f PerfMonNetwork.xml
OK - All performance counters between range | 'BytesTotalSec'=1885.7051B;15728640;17825790;0;20971520 'BytesTotalSecPercent'=0%;75;85;0;100 'OutputQueueLength'=0;2;3;;
Example Microsoft SQL counters: check_win_perfmon.exe -f PerfMonMSQL.xml
OK - All performance counters between range | 'TotalServerMemory'=8381528KB;14680060;16252930;0;16777220 'TotalServerMemoryPercent'=50%;88;97;0;100 'TargetServerMemory'=8388608KB;14680060;16252930;0;16777220 'TargetServerMemoryPercent'=50%;88;97;0;100 'PageReadsSec'=0;90;100;; 'PageWritesSec'=0;90;100;; 'BufferCacheHitRatio'=100;95;90;0;100 'BufferCacheHitRatioPercent'=100%;95;90;0;100 'PageLifeExpectancy'=109982.6641;400;300;; 'LazyWritesSec'=0;15;20;; 'FreeListStallsSec'=0;1;2;; 'MemoryGrantsPending'=0;1;2;; 'BatchRequestsSec'=16.6571;1000;2000;; 'UserConnections'=115.3333;600;700;; 'LockWaitsSec'=0;1;2;; 'ProcessesBlocked'=0;1;2;;
-----------------------------------------------------------------
Creating new XML files to check your own performance counters
-----------------------------------------------------------------
You can set up your own performance counters adding them to xml files or creating new ones.
To list available performance counters on a system in a PowerShell console type:
PowerShell
# Get all counters
Get-Counter -ListSet * | Select-Object -ExpandProperty Counter
# Get specified counter
Get-Counter -ListSet *processor* | Select-Object -ExpandProperty Counter
You can check performance counters on a Windows system: Start Menu->Administrative Tools->Performance Monitor->Clic on plus symbol
XML Format
------------
XML file used must have the following format, for example:
(Check GitHub for example)
Warning: Counter names must be in english.
In the example above, program will check two counters. For each counter, we need to set:
* category: Category of performance counter
* name: Name of the performance counter.
* instance: Instance of performance counter. Some performance counter does not have instance, in this case the value must be: none.
* autonetwork: detects main network interface.
* autodisk: detect system disk.
* friendlyname: name of performance counter which program returns in performance output.
* units: units program returns in performance output.
* warning: Warning threshold for performance counter.
* critical: Critical threshold for performance counter.
* min: minimum value of performance counter. If you do not know the minimum value, it has to be: none.
* max: maximum value of performance counter. If you do not know the maximum value, it has to be: none.
* autonetwork: detects network interface speed in kb/s.
* automemory: detects system memory.
If max and min are specified, program returns one more performance result for calculated percent value.
Max and min must have different value.
If you want to check only warning or critical threshold, it should have the format: lt
For example, warning if counter is less or equal than 15:
(Check GitHub for example)
Critical if counter is greater or equal than 90% of max:
(Check GitHub for example)
----------------------
XML with parameters
----------------------
To avoid creating an xml file for each network interface, disk or sql instance, we can create a generic xml file with parameters, for example.
(Check GitHub for example)
To pass parameters:
check_win_perfmon.exe -f PerfMonNetworkParams.xml -p "Interface 1" "1" "2" "Interface 2" "5"
Params of type {n} will be replaced in order.
XML file would be:
(Check GitHub for example)
You can use two parĂ¡meters in same field too.
(Check GitHub for example)
To check it:
check_win_perfmon.exe -f PerfMonDiskParams.xml -p "1" "D"
check_win_perfmon.exe -f PerfMonDiskParams.xml -p "3" "F"
-------------
System Load
-------------
I tried to minimize system load during program execution, but check performance counters allways has an impact on system performance. Program execution has a 5% of CPU usage on old systems and a minimun impact on modern servers. The more performance counters you check at a time, the more system impact.
-------------
References
-------------
Values and counters are based on System Center Operations Manager checkins. You can check it out http://mpwiki.viacode.com/default.aspx?g=posts&t=219816.
Values and counters for Microsoft SQL are based on articles from https://www.sqlshack.com/sql-server-memory-performance-metrics-part-1-memory-pagessec-memory-page-faultssec/ and http://www.databasejournal.com/features/mssql/article.php/3932406/Top-10-SQL-Server-Counters-for-Monitoring-SQL-Server-Performance.htm.
Updated tresholds based on the amazing tool https://github.com/clinthuffman/PAL created by Clint Huffman from Microsoft.
Reviews (1)
Thank you for this great plugin. I really appreciate your work and especially viariability. It is amazing to know that I can add almost any performance counter by simple XML file and use your script with Nagis.
I have a question related to the Network performance check. The warning and Critical threshold you have set in your XML file seems to have quite low values to me. If I count with 1Gb interface than your warning threshold is just around 13% of maximum utilization.
Maybe I got your thresholds wrong, please can you confirm my thoughts or explain why you used these values.
Thank you, Jakub
I have a question related to the Network performance check. The warning and Critical threshold you have set in your XML file seems to have quite low values to me. If I count with 1Gb interface than your warning threshold is just around 13% of maximum utilization.
Maybe I got your thresholds wrong, please can you confirm my thoughts or explain why you used these values.
Thank you, Jakub
Owner's reply
Hi Jakub! You are right, my network thresholds are very low because my network is very slow. By the way I have added auto detection for network bandwidth in 1.3 version.