Win32_PerfFormattedData_APIPerf perl 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_PerfFormattedData_APIPerf WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Sample Code
use Win32::OLE('in'); my $computer = "."; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_PerfFormattedData_APIPerf_LCAPI00APIApplicationInstanceCounters", "WQL"); foreach my $objItem (in $colItems) { print "API000TransactionEventsProcessedPerSec: $objItem->{API000TransactionEventsProcessedPerSec}\n"; print "API001MessagesProcessedPerSec: $objItem->{API001MessagesProcessedPerSec}\n"; print "API002ActiveTransactionsContexts: $objItem->{API002ActiveTransactionsContexts}\n"; print "API003RequestTransactionsProcessed: $objItem->{API003RequestTransactionsProcessed}\n"; print "API004ResponseTransactionsProcessed: $objItem->{API004ResponseTransactionsProcessed}\n"; print "API005ACKTransactionsProcessed: $objItem->{API005ACKTransactionsProcessed}\n"; print "API006BENOTIFYTransactionsProcessed: $objItem->{API006BENOTIFYTransactionsProcessed}\n"; print "API007TimeoutTransactionsProcessed: $objItem->{API007TimeoutTransactionsProcessed}\n"; print "API008CancelTransactionsProcessed: $objItem->{API008CancelTransactionsProcessed}\n"; print "API009RequestssimpleproxiedfromSPL: $objItem->{API009RequestssimpleproxiedfromSPL}\n"; print "API010RequestssimpleproxiedfromSPLPerSec: $objItem->{API010RequestssimpleproxiedfromSPLPerSec}\n"; print "API011ResponsessimpleproxiedfromSPL: $objItem->{API011ResponsessimpleproxiedfromSPL}\n"; print "API012ResponsessimpleproxiedfromSPLPerSec: $objItem->{API012ResponsessimpleproxiedfromSPLPerSec}\n"; print "API013RequestssimpleproxiedfromServerAgent: $objItem->{API013RequestssimpleproxiedfromServerAgent}\n"; print "API014RequestssimpleproxiedfromServerAgentPerSec: $objItem->{API014RequestssimpleproxiedfromServerAgentPerSec}\n"; print "API015ResponsessimpleproxiedfromServerAgent: $objItem->{API015ResponsessimpleproxiedfromServerAgent}\n"; print "API016ResponsessimpleproxiedfromServerAgentPerSec: $objItem->{API016ResponsessimpleproxiedfromServerAgentPerSec}\n"; print "API017Requestsforwardedusingforkingproxy: $objItem->{API017Requestsforwardedusingforkingproxy}\n"; print "API018RequestsforwardedusingforkingproxyPerSec: $objItem->{API018RequestsforwardedusingforkingproxyPerSec}\n"; print "API019Responsesforwardedusingforkingproxy: $objItem->{API019Responsesforwardedusingforkingproxy}\n"; print "API020ResponsesforwardedusingforkingproxyPerSec: $objItem->{API020ResponsesforwardedusingforkingproxyPerSec}\n"; print "API021Locallygeneratedresponses: $objItem->{API021Locallygeneratedresponses}\n"; print "API022ApplicationScriptErrors: $objItem->{API022ApplicationScriptErrors}\n"; print "API023SystemErrorsIgnored: $objItem->{API023SystemErrorsIgnored}\n"; print "API024DispatchNotificationCalls: $objItem->{API024DispatchNotificationCalls}\n"; print "API025DispatchNotificationCallsPerSec: $objItem->{API025DispatchNotificationCallsPerSec}\n"; print "API026TransactionsPendingDispatchCompletion: $objItem->{API026TransactionsPendingDispatchCompletion}\n"; print "API027Dispatchcallstimedout: $objItem->{API027Dispatchcallstimedout}\n"; print "API028DispatchCallsTimedoutPerSec: $objItem->{API028DispatchCallsTimedoutPerSec}\n"; print "API029SAWriteQueueMaximumLength: $objItem->{API029SAWriteQueueMaximumLength}\n"; print "API030SAWriteQueueLength: $objItem->{API030SAWriteQueueLength}\n"; print "API031QueuedSABatchesPerSec: $objItem->{API031QueuedSABatchesPerSec}\n"; print "API032ASReadQueueLength: $objItem->{API032ASReadQueueLength}\n"; print "API033DequeuedASBatchesPerSec: $objItem->{API033DequeuedASBatchesPerSec}\n"; print "API034SAReadQueueLength: $objItem->{API034SAReadQueueLength}\n"; print "API035ASWriteQueueLength: $objItem->{API035ASWriteQueueLength}\n"; print "API036SAQueueFreeBytesKB: $objItem->{API036SAQueueFreeBytesKB}\n"; print "API037ASQueueFreeBytesKB: $objItem->{API037ASQueueFreeBytesKB}\n"; print "API038ApplicationDispatchfailures: $objItem->{API038ApplicationDispatchfailures}\n"; print "Caption: $objItem->{Caption}\n"; print "Description: $objItem->{Description}\n"; print "Frequency_Object: $objItem->{Frequency_Object}\n"; print "Frequency_PerfTime: $objItem->{Frequency_PerfTime}\n"; print "Frequency_Sys100NS: $objItem->{Frequency_Sys100NS}\n"; print "Name: $objItem->{Name}\n"; print "Timestamp_Object: $objItem->{Timestamp_Object}\n"; print "Timestamp_PerfTime: $objItem->{Timestamp_PerfTime}\n"; print "Timestamp_Sys100NS: $objItem->{Timestamp_Sys100NS}\n"; print "\n"; print "########\n"; print "\n"; }