Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » jscript sample

Win32_PerfRawData_APIPerf jscript sample code

The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_PerfRawData_APIPerf WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

var strComputer = ".";

var objWMIService = GetObject("winmgmts:\\\\" + strComputer + "\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_APIPerf_LCAPI00APIApplicationInstanceCounters", "WQL");

var enumItems = new Enumerator(colItems);

for (; !enumItems.atEnd(); enumItems.moveNext()) {
	var objItem = enumItems.item();
	WScript.Echo("API000TransactionEventsProcessedPerSec: " + objItem.API000TransactionEventsProcessedPerSec);
	WScript.Echo("API001MessagesProcessedPerSec: " + objItem.API001MessagesProcessedPerSec);
	WScript.Echo("API002ActiveTransactionsContexts: " + objItem.API002ActiveTransactionsContexts);
	WScript.Echo("API003RequestTransactionsProcessed: " + objItem.API003RequestTransactionsProcessed);
	WScript.Echo("API004ResponseTransactionsProcessed: " + objItem.API004ResponseTransactionsProcessed);
	WScript.Echo("API005ACKTransactionsProcessed: " + objItem.API005ACKTransactionsProcessed);
	WScript.Echo("API006BENOTIFYTransactionsProcessed: " + objItem.API006BENOTIFYTransactionsProcessed);
	WScript.Echo("API007TimeoutTransactionsProcessed: " + objItem.API007TimeoutTransactionsProcessed);
	WScript.Echo("API008CancelTransactionsProcessed: " + objItem.API008CancelTransactionsProcessed);
	WScript.Echo("API009RequestssimpleproxiedfromSPL: " + objItem.API009RequestssimpleproxiedfromSPL);
	WScript.Echo("API010RequestssimpleproxiedfromSPLPerSec: " + objItem.API010RequestssimpleproxiedfromSPLPerSec);
	WScript.Echo("API011ResponsessimpleproxiedfromSPL: " + objItem.API011ResponsessimpleproxiedfromSPL);
	WScript.Echo("API012ResponsessimpleproxiedfromSPLPerSec: " + objItem.API012ResponsessimpleproxiedfromSPLPerSec);
	WScript.Echo("API013RequestssimpleproxiedfromServerAgent: " + objItem.API013RequestssimpleproxiedfromServerAgent);
	WScript.Echo("API014RequestssimpleproxiedfromServerAgentPerSec: " + objItem.API014RequestssimpleproxiedfromServerAgentPerSec);
	WScript.Echo("API015ResponsessimpleproxiedfromServerAgent: " + objItem.API015ResponsessimpleproxiedfromServerAgent);
	WScript.Echo("API016ResponsessimpleproxiedfromServerAgentPerSec: " + objItem.API016ResponsessimpleproxiedfromServerAgentPerSec);
	WScript.Echo("API017Requestsforwardedusingforkingproxy: " + objItem.API017Requestsforwardedusingforkingproxy);
	WScript.Echo("API018RequestsforwardedusingforkingproxyPerSec: " + objItem.API018RequestsforwardedusingforkingproxyPerSec);
	WScript.Echo("API019Responsesforwardedusingforkingproxy: " + objItem.API019Responsesforwardedusingforkingproxy);
	WScript.Echo("API020ResponsesforwardedusingforkingproxyPerSec: " + objItem.API020ResponsesforwardedusingforkingproxyPerSec);
	WScript.Echo("API021Locallygeneratedresponses: " + objItem.API021Locallygeneratedresponses);
	WScript.Echo("API022ApplicationScriptErrors: " + objItem.API022ApplicationScriptErrors);
	WScript.Echo("API023SystemErrorsIgnored: " + objItem.API023SystemErrorsIgnored);
	WScript.Echo("API024DispatchNotificationCalls: " + objItem.API024DispatchNotificationCalls);
	WScript.Echo("API025DispatchNotificationCallsPerSec: " + objItem.API025DispatchNotificationCallsPerSec);
	WScript.Echo("API026TransactionsPendingDispatchCompletion: " + objItem.API026TransactionsPendingDispatchCompletion);
	WScript.Echo("API027Dispatchcallstimedout: " + objItem.API027Dispatchcallstimedout);
	WScript.Echo("API028DispatchCallsTimedoutPerSec: " + objItem.API028DispatchCallsTimedoutPerSec);
	WScript.Echo("API029SAWriteQueueMaximumLength: " + objItem.API029SAWriteQueueMaximumLength);
	WScript.Echo("API030SAWriteQueueLength: " + objItem.API030SAWriteQueueLength);
	WScript.Echo("API031QueuedSABatchesPerSec: " + objItem.API031QueuedSABatchesPerSec);
	WScript.Echo("API032ASReadQueueLength: " + objItem.API032ASReadQueueLength);
	WScript.Echo("API033DequeuedASBatchesPerSec: " + objItem.API033DequeuedASBatchesPerSec);
	WScript.Echo("API034SAReadQueueLength: " + objItem.API034SAReadQueueLength);
	WScript.Echo("API035ASWriteQueueLength: " + objItem.API035ASWriteQueueLength);
	WScript.Echo("API036SAQueueFreeBytesKB: " + objItem.API036SAQueueFreeBytesKB);
	WScript.Echo("API037ASQueueFreeBytesKB: " + objItem.API037ASQueueFreeBytesKB);
	WScript.Echo("API038ApplicationDispatchfailures: " + objItem.API038ApplicationDispatchfailures);
	WScript.Echo("Caption: " + objItem.Caption);
	WScript.Echo("Description: " + objItem.Description);
	WScript.Echo("Frequency_Object: " + objItem.Frequency_Object);
	WScript.Echo("Frequency_PerfTime: " + objItem.Frequency_PerfTime);
	WScript.Echo("Frequency_Sys100NS: " + objItem.Frequency_Sys100NS);
	WScript.Echo("Name: " + objItem.Name);
	WScript.Echo("Timestamp_Object: " + objItem.Timestamp_Object);
	WScript.Echo("Timestamp_PerfTime: " + objItem.Timestamp_PerfTime);
	WScript.Echo("Timestamp_Sys100NS: " + objItem.Timestamp_Sys100NS);
	WScript.Echo("")
	WScript.Echo("########")
	WScript.Echo("")
}