Can you help me to add custom WMI monitors?
Q: Can you help me to add a custom WMI monitor? For example, what query can be used to check disk C: Read & Write Bytes per Sec?
A: The following custom WMI Query can be used:
SELECT DiskBytesPerSec FROM Win32_PerfFormattedData_PerfDisk_LogicalDisk WHERE Name = "C:"
In general, if you need to read a Windows performance counter value, you should
- Find the corresponding Win32_PerfFormattedData-derived WMI class:
http://msdn.microsoft.com/en-us/library/aa392397
http://msdn.microsoft.com/en-us/library/aa394253 - Choose the needed class property (properties correspond to counters). For example, properties of Win32_PerfFormattedData_PerfDisk_LogicalDisk class can be found at:
http://msdn.microsoft.com/en-us/library/aa394261 - Construct the WMI Query as
SELECT <property name> FROM WHERE Name = <instance name>Note: WHERE clause is required if there are several instances (e.g. if several logical disks are configured)
Related topics
Check out our Knowledge Base where we answer questions regarding various topics. Use SELECT DiskBytesPerSec FROM Win32_PerfFormattedData_PerfDisk_LogicalDisk WHERE Name = “C:” to read the combined disk bytes per second value for drive C:. Find the Win32_PerfFormattedData-derived class that corresponds to the Windows performance object, then select the property that matches the counter you want to monitor. A WHERE clause selects the correct instance, such as a specific logical disk, when the WMI class can return several instances.
Frequently Asked Questions
Which WMI query can monitor C: disk read and write bytes per second?
How do I choose a WMI class for a Windows performance counter?
Why is a WHERE clause often needed in a WMI performance query?