zabbix_export: version: '5.4' date: '2021-11-21T21:37:39Z' groups: - uuid: 2dc86ff46cd84ef0bc8767927da63793 name: A-OVR_TPLGPR templates: - uuid: ffdb3a6a238f485f9c23a3c4d1cace87 template: 'Windows Physical Disk IOPS' name: 'Windows Physical Disk IOPS' description: | ## Overview This template discover physical disk thrue a powershell code. As i hate myself to deploy third party scripts on my agents, the powershell code is embeded in this template macro, this mean that you don't have to deploy any additionnal scripts to get it work. It also use "zabbix active" items to get work behind firewall. Data are retrieved thrue perfmon values, the template has been made to be compatible with all OS language using numeric value of perfcounter. This template is better than others because this one calculate the IOPS per physical disk instead of logical drive, meaning a better estimation of true saturation of a disk. If trigger fire on physical disk too much, it's time to buy SSD :) Look at the attached screenshots to get a better idea of it. Enjoy PS: powershell macro has been base64 encoded to be more easy to deploy, if you do not trust the code you can easily revert it back to something readable or just look at the Zabbix Agent log to see the command executed Tested from Windows 7 till 2016 with success. ## Author Cédric MARCOUX groups: - name: A-OVR_TPLGPR discovery_rules: - uuid: 1ff548e848a5424a9046a2aefe2fcafe name: 'Discover PhysicalDisk' type: ZABBIX_ACTIVE key: 'system.run[%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy ByPass -nologo -EncodedCommand {$DISCOVERDISK1}{$DISCOVERDISK2}{$DISCOVERDISK3}{$DISCOVERDISK4}{$DISCOVERDISK5}]' delay: 1d lifetime: 7d description: | Encoded command splitted in 5 macro: $drives = Get-WmiObject win32_PerfFormattedData_PerfDisk_PhysicalDisk | ?{$_.name -ne "_Total"} | Select Name;$idx = 1;write-host "{";write-host " `"data`":[`n";foreach ($perfDrives in $drives){if ($idx -lt $drives.Count){ $line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.Name + "`" },";write-host $line;}elseif ($idx -ge $drives.Count){$line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.Name + "`" }";write-host $line;}$idx++;};write-host;write-host " ]";write-host "}"; item_prototypes: - uuid: c2c23b3967a94e81ac1567b9ad0ed8fb name: 'Disk ({#DISKNUMLET}) - Average Disk Bytes Total' type: CALCULATED key: 'AvgDiskBytesTotal[({#DISKNUMLET})]' delay: 15s history: 7d value_type: FLOAT units: B params: 'last(//perf_counter["\234({#DISKNUMLET})\226"])+last(//perf_counter["\234({#DISKNUMLET})\228"])' tags: - tag: Application value: PhysicalDisk - uuid: 110005daad3c4cb3b793aad0b8a49f3a name: 'Disk ({#DISKNUMLET}) - % Disk saturation' type: CALCULATED key: 'DiskSaturation[({#DISKNUMLET})]' delay: 15s history: 7d value_type: FLOAT params: '100-last(//perf_counter["\234({#DISKNUMLET})\1482"])' tags: - tag: Application value: PhysicalDisk - uuid: 74e4f216acfa43a0a7eaa322b3ef2986 name: 'Disk ({#DISKNUMLET}) - Current Disk Queue Length' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\198"]' delay: 15s history: 7d value_type: FLOAT tags: - tag: Application value: PhysicalDisk - uuid: a0a05abf317f455a985ab09af360e705 name: 'Disk ({#DISKNUMLET}) - Avg. Disk sec/Read (Latency)' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\208"]' delay: 15s history: 7d value_type: FLOAT units: s tags: - tag: Application value: PhysicalDisk - uuid: d488b0d7889547a68c2b9890d3d1ef68 name: 'Disk ({#DISKNUMLET}) - Avg. Disk sec/Write (Latency)' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\210"]' delay: 15s history: 7d value_type: FLOAT units: s tags: - tag: Application value: PhysicalDisk - uuid: 99aec227abc44b00a4627988ca5ab2bf name: 'Disk ({#DISKNUMLET}) - Avg. Disk sec/Transfer (Latency)' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\212"]' delay: 15s history: 7d value_type: FLOAT units: s description: | Avg. Disk sec/Transfer (Avg. Disk sec/Read, Avg. Disk sec/Write) Displays the average time the disk transfers took to complete, in seconds. Although the scale is seconds, the counter has millisecond precision, meaning a value of 0.004 indicates the average time for disk transfers to complete was 4 milliseconds. This is the counter in Perfmon used to measure IO latency. preprocessing: - type: MULTIPLIER parameters: - '0.001' tags: - tag: Application value: PhysicalDisk trigger_prototypes: - uuid: d00e574a7ec64a81ade084bd514f4dc2 expression: 'avg(/Windows Physical Disk IOPS/perf_counter["\234({#DISKNUMLET})\212"],1m)>=20' recovery_mode: RECOVERY_EXPRESSION recovery_expression: 'avg(/Windows Physical Disk IOPS/perf_counter["\234({#DISKNUMLET})\212"],1m)<20' name: 'Disk ({#DISKNUMLET}) - Disk high latency (>20ms) since 1 minute' priority: WARNING description: 'Should not be higher than ~20ms' manual_close: 'YES' - uuid: 46c632ae9aae4a31aaa59ac1b86316d6 name: 'Disk ({#DISKNUMLET}) - Average Disk Bytes Read' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\226"]' delay: 15s history: 7d value_type: FLOAT units: B tags: - tag: Application value: PhysicalDisk - uuid: 16408fb2bd5a4972923fcf793a263cab name: 'Disk ({#DISKNUMLET}) - Average Disk Bytes Write' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\228"]' delay: 15s history: 7d value_type: FLOAT units: B tags: - tag: Application value: PhysicalDisk - uuid: 642d2863c5c4464791bb2826df20605d name: 'Disk ({#DISKNUMLET}) - Avg. Disk Queue Length' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\1400"]' delay: 15s history: 7d value_type: FLOAT tags: - tag: Application value: PhysicalDisk - uuid: 6dc439d1352e428c9b345c2f3b466d66 name: 'Disk ({#DISKNUMLET}) - % Idle Time' type: ZABBIX_ACTIVE key: 'perf_counter["\234({#DISKNUMLET})\1482"]' delay: 15s history: 7d value_type: FLOAT tags: - tag: Application value: PhysicalDisk trigger_prototypes: - uuid: daf89e634b7248aeae34b784fbb60562 expression: 'avg(/Windows Physical Disk IOPS/DiskSaturation[({#DISKNUMLET})],5m)>=99 or avg(/Windows Physical Disk IOPS/perf_counter["\234({#DISKNUMLET})\1400"],1m)>=20' recovery_mode: RECOVERY_EXPRESSION recovery_expression: 'avg(/Windows Physical Disk IOPS/DiskSaturation[({#DISKNUMLET})],5m)<99 or avg(/Windows Physical Disk IOPS/perf_counter["\234({#DISKNUMLET})\1400"],1m)<20' name: 'Disk ({#DISKNUMLET}) - Disk activity saturation for 5 minutes' priority: WARNING description: | % Idle Time This counter provides a very precise measurement of how much time the disk remained in idle state, meaning all the requests from the operating system to the disk have been completed and there is zero pending requests. This is how it’s calculated, the system timestamps an event when the disk goes idle, then timestamps another event when the disk receives a new request. At the end of the capture interval, we calculate the percentage of the time spent in idle. This counter ranges from 100 (meaning always Idle) to 0 (meaning always busy). manual_close: 'YES' graph_prototypes: - uuid: b0b20cdb2a9a49a2b154e146678f2e60 name: 'Disk ({#DISKNUMLET}) - Data Rate' ymin_type_1: FIXED graph_items: - drawtype: GRADIENT_LINE color: 1A7C11 item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\226"]' - sortorder: '1' drawtype: GRADIENT_LINE color: F63100 item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\228"]' - sortorder: '2' drawtype: BOLD_LINE color: 2774A4 item: host: 'Windows Physical Disk IOPS' key: 'AvgDiskBytesTotal[({#DISKNUMLET})]' - uuid: 4f0df4de174d476db8dfc1b6e64a3354 name: 'Disk ({#DISKNUMLET}) - Latency' ymin_type_1: FIXED graph_items: - drawtype: GRADIENT_LINE color: 1A7C11 item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\208"]' - sortorder: '1' drawtype: BOLD_LINE color: F63100 item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\212"]' - sortorder: '2' drawtype: GRADIENT_LINE color: 2774A4 item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\210"]' - uuid: e06ffbcb6f0e43138b334c4f493d86b8 name: 'Disk ({#DISKNUMLET}) - Saturation and Queue' ymin_type_1: FIXED ymax_type_1: FIXED graph_items: - drawtype: GRADIENT_LINE color: 1A7C11 item: host: 'Windows Physical Disk IOPS' key: 'DiskSaturation[({#DISKNUMLET})]' - sortorder: '1' drawtype: BOLD_LINE color: F63100 yaxisside: RIGHT item: host: 'Windows Physical Disk IOPS' key: 'perf_counter["\234({#DISKNUMLET})\198"]' macros: - macro: '{$DISCOVERDISK1}' value: JABkAHIAaQB2AGUAcwAgAD0AIABHAGUAdAAtAFcAbQBpAE8AYgBqAGUAYwB0ACAAdwBpAG4AMwAyAF8AUABlAHIAZgBGAG8AcgBtAGEAdAB0AGUAZABEAGEAdABhAF8AUABlAHIAZgBEAGkAcwBrAF8AUABoAHkAcwBpAGMAYQBsAEQAaQBzAGsAIAB8ACAAPwB7ACQAXwAuAG4AYQBtAGUAIAAtAG4AZQAgACIAXwBUAG8AdABhAGwAIgB9ACA - macro: '{$DISCOVERDISK2}' value: AfAAgAFMAZQBsAGUAYwB0ACAATgBhAG0AZQA7ACQAaQBkAHgAIAA9ACAAMQA7AHcAcgBpAHQAZQAtAGgAbwBzAHQAIAAiAHsAIgA7AHcAcgBpAHQAZQAtAGgAbwBzAHQAIAAiACAAYAAiAGQAYQB0AGEAYAAiADoAWwBgAG4AIgA7AGYAbwByAGUAYQBjAGgAIAAoACQAcABlAHIAZgBEAHIAaQB2AGUAcwAgAGkAbgAgACQAZAByAGkAdgBlAH - macro: '{$DISCOVERDISK3}' value: MAKQB7AGkAZgAgACgAJABpAGQAeAAgAC0AbAB0ACAAJABkAHIAaQB2AGUAcwAuAEMAbwB1AG4AdAApAHsAIAAgACAAIAAgACAAIAAkAGwAaQBuAGUAPQAgACIAewAgAGAAIgB7ACMARABJAFMASwBOAFUATQBMAEUAVAB9AGAAIgAgADoAIABgACIAIgAgACsAIAAkAHAAZQByAGYARAByAGkAdgBlAHMALgBOAGEAbQBlACAAKwAgACIAYAAiA - macro: '{$DISCOVERDISK4}' value: CAAfQAsACIAOwB3AHIAaQB0AGUALQBoAG8AcwB0ACAAJABsAGkAbgBlADsAfQBlAGwAcwBlAGkAZgAgACgAJABpAGQAeAAgAC0AZwBlACAAJABkAHIAaQB2AGUAcwAuAEMAbwB1AG4AdAApAHsAJABsAGkAbgBlAD0AIAAiAHsAIABgACIAewAjAEQASQBTAEsATgBVAE0ATABFAFQAfQBgACIAIAA6ACAAYAAiACIAIAArACAAJABwAGUAcgBm - macro: '{$DISCOVERDISK5}' value: AEQAcgBpAHYAZQBzAC4ATgBhAG0AZQAgACsAIAAiAGAAIgAgAH0AIgA7AHcAcgBpAHQAZQAtAGgAbwBzAHQAIAAkAGwAaQBuAGUAOwB9ACQAaQBkAHgAKwArADsAfQA7AHcAcgBpAHQAZQAtAGgAbwBzAHQAOwB3AHIAaQB0AGUALQBoAG8AcwB0ACAAIgAgAF0AIgA7AHcAcgBpAHQAZQAtAGgAbwBzAHQAIAAiAH0AIgA7AA0ACgA=