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
Demand background The project is made using Vue, ...
Timer Effects: <div> <font id='timeC...
Table of contents Create a layout Add CSS styles ...
Preface This chapter uses basic Linux functions a...
Page replacement algorithm: The essence is to mak...
In daily work, we sometimes run slow queries to r...
Simple implementation of Mysql add, delete, modif...
First download the latest MySQL 5.7.17 Community ...
CSS naming conventions (rules) Commonly used CSS ...
MyISAM storage engine The MyISAM storage engine i...
Table of contents 1. Swap partition SWAP 1.1 Crea...
Memo: Just experience it. Record: NO.209 This exa...
Table of contents 1. Process Control 2. Sequentia...
A set of projects for training react+ts Although ...