Skip to main content
InSource KnowledgeCenter

TN AppSvr104 Capturing CPU load in Archestra script

insource logo large.jpg

                            Tech Note               

 

Description

When a computer has a platform deployed to it you can usually monitor the CPULoad by simply looking at the CPULoad field for the platform in question.  An alternative approach would be to use a performance counter to get a view into the CPULoad. The script below is an example of how this can be done.

  • Author: Joe Hefner
  • Published: 10/14/2014
  • Applies to: Application Server 3.1 and higher

 

Instructions

 

The sample script above can be copied from below if desired:

 

dim cpuCounter as System.Diagnostics.PerformanceCounter;
cpuCounter = new System.Diagnostics.PerformanceCounter();
cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";

cpuCounter.NextValue();
System.Threading.Thread.Sleep(1000);
LogMessage( "CPU usage: " + cpuCounter.NextValue()+"%");

Confirmation of Success

Check Message Log in System Management Console