troubleshooting Question

VM CPU monitoring using events

Avatar of zozig
zozigFlag for United States of America asked on
.NET Programming
3 Comments1 Solution222 ViewsLast Modified:
Hi everyone,

I'm trying to create a C# program which monitors the cpu level of vms within virtual server.  I've created an event model to captured when the cpu reaches a certain level.  What I am getting stuck on is the best way for me to actually poll the vs and determine when the cpu has hit a certain level.  tried creating an infinite loop that will constantly pool the cpu level, however I'm never done any kind of thread base programming and my current approach will lock the execution of my program.  Can anyone offer any advice on how I would create a monitoring program which constantly polls.  If I should use different threads how should I create and manage them?  Here is what I have so far and you'lll see why I'm having problems:

 public void monitorCpuUtilization()
       {
           while (true)
           {
               Thread.Sleep(6000);
               

               if (CPUUsageAverage > 10)
               {
                   dixpatchcpuUtilizationEvent();
               }
           }
       }

Al input welcome.  Thanks.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros