Background Information I've been rereading some books about Windows performance recently. For a lazy person like me who used to use SCOM monitoring, the Windows OS template that comes with Zabbix is really not enough, because the previous SCOM monitoring package (published by Microsoft, did all the work, and I only needed to enable rules and alarms as needed). The default Zabbix performance data only has Avg Latency, and the average data is not accurate. If you want to see the latency and IOPS of the disk, you have to do it yourself. After looking at the syntax of windows performance counter in zabbix, I backed off a little. The CounterCategory and CounterName of all numeric performance counters. The only statistics related to the built-in disk are the transfer speed and average latency. Windows Performance Monitoring on Zabbix If there are other performance counters to monitor, what are their names and what do they do? Is there a list that can be searched quickly? Solve it Fortunately, PowerShell is easy to write, so I wrote the following function, which integrates the syntax of Zabbix's performance counters. function Get-PerfCounterDesc{ [cmdletbinding()] param( [switch]$show ) $Categories = [System.Diagnostics.PerformanceCounterCategory]::GetCategories() $SingleInstanceCategories = $Categories | Where-Object {$_.CategoryType -eq "SingleInstance"} $MultiInstanceCategories = $Categories| Where-Object {$_.CategoryType -eq "MultiInstance"} $SingleInstanceCounters = $SingleInstanceCategories | ForEach-Object { (new-object System.Diagnostics.PerformanceCounterCategory($_.CategoryName)).GetCounters() } $MultiInstanceCounters = $MultiInstanceCategories | ForEach-Object { $category = new-object System.Diagnostics.PerformanceCounterCategory($_.CategoryName) if($category.InstanceExists('_Total')){ $category.GetCounters('_Total') }elseif($category.InstanceExists('Total')){ $category.GetCounters('Total') }else{ $instanceNames = $category.GetInstanceNames() if($instanceNames.count -gt 0){ $category.GetCounters($instanceNames[0]) } } } $AllCounters = $MultiInstanceCounters + $SingleInstanceCounters $key="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009" $counters=Get-ItemPropertyValue -Path $key -Name "counter" $Dict=@{} for ($i=0;$i -lt $counters.count;$i=$i+2){ if($counters[$i+1] -and -not $Dict.ContainsKey($counters[$i+1])){ $Dict.add($counters[$i+1],$counters[$i]) } } Write-Debug $dict.keys.count $result=$AllCounters | Sort-Object Categoryname,Countername| Select-Object CategoryName, Countername, @{n="zabbixPerfCounter";e={'perf_counter["\{0}({{#ReplaceThis}})\{1}"]' -f $dict[$_.CategoryName],$dict[$_.Countername]}}, @{n="categoryNum";e={$Dict[$_.CategoryName]}}, @{n="CounterNum";e={$Dict[$_.Countername]}}, CategoryHelp, CounterHelp if($show){ $result|Out-GridView }else{ $result } } How to use it? Add the above function directly to your personal PowerShell profile, that is, in the PowerShell console Start a new PowerShell and type Get-PerfCounterDesc -show directly. You can filter the results in various ways. The zabbixPerfCounter column is the key used on the generated zabbix. Please replace {#replaceThis} with the instance name of the counter. For example, _total. Then I added the following counters in the zabbix template to display the disk IOPS and Latency item prototype items You also need to change Grafana accordingly Summarize The above is the method of Windows performance monitoring on Zabbix introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Best way to replace the key in json object
>>: Analysis of the Poor Performance Caused by Large Offset of LIMIT in MySQL Query
After entering the Docker container, if you exit ...
On the server, in order to quickly log in to the ...
String extraction without delimiters Question Req...
Flexible layout (Flexbox) is becoming increasingl...
On a whim, I wrote a case study of a small ball b...
Table of contents 1. Basic use of axio 2. How to ...
1. Pull the image docker pull registry.cn-hangzho...
Learning objectives: The two functions parseInt()...
Preface In the Linux operating system, device fil...
The plugin is installed in the Firefox browser. T...
When using Dreamweaver or FrontPage to create HTM...
For work needs, I need to make a mobile phone adap...
Recently, there is a need to automatically search...
1. Import mysql command The mysql command import ...
Today someone talked to me about a website develo...