Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Windows performance Monitoring on Zabbix

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Background information

Recently, I have been re-reading some books on windows performance. For a lazy person like me who used to use SCOM monitoring, the windows OS template template that comes with Zabbix is really not enough, because the previous SCOM monitoring package (Microsoft has done all the work, I just need to enable rules and alarms as needed).

The default Zabbix performance data is only Avg Latency, and the average data is not accurate. If you want to see the disk Latency and IOPS, you have to do it yourself. I flinched slightly after looking at the syntax of windows performance Counter in zabbix. All are the CounterCategory and CounterName of performance counters represented by numbers.

The only statistics related to BYOD are transmission speed and average delay.

If you want to monitor other performance counters, what are their names and what are their functions? Is there a list that can be searched quickly?

Use the knife to solve the problem

Fortunately, powershell is easy to write. I wrote the following function, which integrates the syntax of zabbix's performance counter.

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 ($iTun0 $I-lt $counters.count;$i=$i+2) {if ($counters [$item1]-and-not $Dict.ContainsKey ($counters [$item1])) {$Dict.add ($counters [$item1], $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 do I use it? Add the above function directly to the personal powershell configuration file, that is, notepad $profile in the powershell console, paste the content in, save it, and then set set-executionpolicy remotesigned so that custom unsigned scripts can be run.

A new powershell can be used to filter the results by directly tapping Get-PerfCounterDesc-show. The zabbixPerfCounter column is the key used on the generated zabbix, and the {# replaceThis} in it should be replaced with the instance name of the counter. For example, _ total.

Then I added the following counter to the zabbix template to display disk IOPS and Latency

Item prototype

Items

You also need to change the Grafana accordingly

Incidental resources and references

In the middle of writing, the result of National Day, let everyone have a rest, so the resources have been unable to make up.

Put it on github to facilitate subsequent updates and replenishment of https://github.com/yoke88/WindowsPerfMonitorWithZabbix

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report