Hi,
I am new to WMI
and System.Diagnostics
etc.
I need to write something (a service?) that monitors several processes for CPU Usage %.
When I am in Task Manager, the CPU column is the one that I want (i.e. the percentage).
I need to be able to run this on a remote machine, and have it check the CPU Usage every second or so. When the usage is over 30%, I need for the offending service to be restarted automatically.
I have read through all(read:most) of the Related questions, and I think the PerformanceCounter is probably the one I need to use, but I am unsure as to whether or not I need one of these for each process, and how to locate the process, (it has to be name based, not PID based).
Can anyone please advise.
Summary
- I don't want to loop through all processes on the machine (if I can avoid it)
- I need the CPU Usage % of the process
- I need to restart a process if the usage is over 30%.
Thanks