Hi,
I have been trying to implement a simple system monitor application using WMI from information gathered here and elsewhere on the Internet but I am not being able to make it work. The parameters I'd like to monitor are: CPU Usage, Free Physical Memory and Network usage (upload and donwload BPS).
Upon some research I think that I have determined all properties and classes needed.
CPU Usage
Class: Win32_PerfFormattedData_Pe
rfOS_Proce
ssor
Property: PercentProcessorTime
Instance: _Total (if there are more than one processor) else only instance.
Free Physical Memory
Class: Win32_PerfFormattedData_Pe
rfOs_Memor
y
Property: AvailableBytes
Instance: Only one instance
Network Usage
Class: Win32_PerfFormattedData_Tc
pip_
Property: BytesReceivedPerSec and BytesSentPerSec
Instance: I suppose the sensible thing to do is to add-up all the values from existing instances
(I am not sure if I should also take into account a possible RAS connection or not)
Maybe I could use the PerfRawData alternatives, I am not sure. I would need the application to work, at least, in the following OS: 2000,2003, XP and Vista.
It might be that the application should get the appropriate permissions on Vista (and maybe Win2003) to get access to some of the above classes. Or that I have to somehow refresh the values. Also I would like, for obvious reasons to make the code as effective as possible since it will be running constantly, gathering information once per second.
Start Free Trial