Win32_PerfFormattedData_APIPerf python 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
from win32com.client import GetObject objWMI = GetObject('winmgmts:').InstancesOf('Win32_PerfFormattedData_APIPerf_LCAPI00APIApplicationInstanceCounters') for obj in objWMI: if obj.API000TransactionEventsProcessedPerSec != None: print("API000TransactionEventsProcessedPerSec:" + str(obj.API000TransactionEventsProcessedPerSec)) if obj.API001MessagesProcessedPerSec != None: print("API001MessagesProcessedPerSec:" + str(obj.API001MessagesProcessedPerSec)) if obj.API002ActiveTransactionsContexts != None: print("API002ActiveTransactionsContexts:" + str(obj.API002ActiveTransactionsContexts)) if obj.API003RequestTransactionsProcessed != None: print("API003RequestTransactionsProcessed:" + str(obj.API003RequestTransactionsProcessed)) if obj.API004ResponseTransactionsProcessed != None: print("API004ResponseTransactionsProcessed:" + str(obj.API004ResponseTransactionsProcessed)) if obj.API005ACKTransactionsProcessed != None: print("API005ACKTransactionsProcessed:" + str(obj.API005ACKTransactionsProcessed)) if obj.API006BENOTIFYTransactionsProcessed != None: print("API006BENOTIFYTransactionsProcessed:" + str(obj.API006BENOTIFYTransactionsProcessed)) if obj.API007TimeoutTransactionsProcessed != None: print("API007TimeoutTransactionsProcessed:" + str(obj.API007TimeoutTransactionsProcessed)) if obj.API008CancelTransactionsProcessed != None: print("API008CancelTransactionsProcessed:" + str(obj.API008CancelTransactionsProcessed)) if obj.API009RequestssimpleproxiedfromSPL != None: print("API009RequestssimpleproxiedfromSPL:" + str(obj.API009RequestssimpleproxiedfromSPL)) if obj.API010RequestssimpleproxiedfromSPLPerSec != None: print("API010RequestssimpleproxiedfromSPLPerSec:" + str(obj.API010RequestssimpleproxiedfromSPLPerSec)) if obj.API011ResponsessimpleproxiedfromSPL != None: print("API011ResponsessimpleproxiedfromSPL:" + str(obj.API011ResponsessimpleproxiedfromSPL)) if obj.API012ResponsessimpleproxiedfromSPLPerSec != None: print("API012ResponsessimpleproxiedfromSPLPerSec:" + str(obj.API012ResponsessimpleproxiedfromSPLPerSec)) if obj.API013RequestssimpleproxiedfromServerAgent != None: print("API013RequestssimpleproxiedfromServerAgent:" + str(obj.API013RequestssimpleproxiedfromServerAgent)) if obj.API014RequestssimpleproxiedfromServerAgentPerSec != None: print("API014RequestssimpleproxiedfromServerAgentPerSec:" + str(obj.API014RequestssimpleproxiedfromServerAgentPerSec)) if obj.API015ResponsessimpleproxiedfromServerAgent != None: print("API015ResponsessimpleproxiedfromServerAgent:" + str(obj.API015ResponsessimpleproxiedfromServerAgent)) if obj.API016ResponsessimpleproxiedfromServerAgentPerSec != None: print("API016ResponsessimpleproxiedfromServerAgentPerSec:" + str(obj.API016ResponsessimpleproxiedfromServerAgentPerSec)) if obj.API017Requestsforwardedusingforkingproxy != None: print("API017Requestsforwardedusingforkingproxy:" + str(obj.API017Requestsforwardedusingforkingproxy)) if obj.API018RequestsforwardedusingforkingproxyPerSec != None: print("API018RequestsforwardedusingforkingproxyPerSec:" + str(obj.API018RequestsforwardedusingforkingproxyPerSec)) if obj.API019Responsesforwardedusingforkingproxy != None: print("API019Responsesforwardedusingforkingproxy:" + str(obj.API019Responsesforwardedusingforkingproxy)) if obj.API020ResponsesforwardedusingforkingproxyPerSec != None: print("API020ResponsesforwardedusingforkingproxyPerSec:" + str(obj.API020ResponsesforwardedusingforkingproxyPerSec)) if obj.API021Locallygeneratedresponses != None: print("API021Locallygeneratedresponses:" + str(obj.API021Locallygeneratedresponses)) if obj.API022ApplicationScriptErrors != None: print("API022ApplicationScriptErrors:" + str(obj.API022ApplicationScriptErrors)) if obj.API023SystemErrorsIgnored != None: print("API023SystemErrorsIgnored:" + str(obj.API023SystemErrorsIgnored)) if obj.API024DispatchNotificationCalls != None: print("API024DispatchNotificationCalls:" + str(obj.API024DispatchNotificationCalls)) if obj.API025DispatchNotificationCallsPerSec != None: print("API025DispatchNotificationCallsPerSec:" + str(obj.API025DispatchNotificationCallsPerSec)) if obj.API026TransactionsPendingDispatchCompletion != None: print("API026TransactionsPendingDispatchCompletion:" + str(obj.API026TransactionsPendingDispatchCompletion)) if obj.API027Dispatchcallstimedout != None: print("API027Dispatchcallstimedout:" + str(obj.API027Dispatchcallstimedout)) if obj.API028DispatchCallsTimedoutPerSec != None: print("API028DispatchCallsTimedoutPerSec:" + str(obj.API028DispatchCallsTimedoutPerSec)) if obj.API029SAWriteQueueMaximumLength != None: print("API029SAWriteQueueMaximumLength:" + str(obj.API029SAWriteQueueMaximumLength)) if obj.API030SAWriteQueueLength != None: print("API030SAWriteQueueLength:" + str(obj.API030SAWriteQueueLength)) if obj.API031QueuedSABatchesPerSec != None: print("API031QueuedSABatchesPerSec:" + str(obj.API031QueuedSABatchesPerSec)) if obj.API032ASReadQueueLength != None: print("API032ASReadQueueLength:" + str(obj.API032ASReadQueueLength)) if obj.API033DequeuedASBatchesPerSec != None: print("API033DequeuedASBatchesPerSec:" + str(obj.API033DequeuedASBatchesPerSec)) if obj.API034SAReadQueueLength != None: print("API034SAReadQueueLength:" + str(obj.API034SAReadQueueLength)) if obj.API035ASWriteQueueLength != None: print("API035ASWriteQueueLength:" + str(obj.API035ASWriteQueueLength)) if obj.API036SAQueueFreeBytesKB != None: print("API036SAQueueFreeBytesKB:" + str(obj.API036SAQueueFreeBytesKB)) if obj.API037ASQueueFreeBytesKB != None: print("API037ASQueueFreeBytesKB:" + str(obj.API037ASQueueFreeBytesKB)) if obj.API038ApplicationDispatchfailures != None: print("API038ApplicationDispatchfailures:" + str(obj.API038ApplicationDispatchfailures)) if obj.Caption != None: print("Caption:" + str(obj.Caption)) if obj.Description != None: print("Description:" + str(obj.Description)) if obj.Frequency_Object != None: print("Frequency_Object:" + str(obj.Frequency_Object)) if obj.Frequency_PerfTime != None: print("Frequency_PerfTime:" + str(obj.Frequency_PerfTime)) if obj.Frequency_Sys100NS != None: print("Frequency_Sys100NS:" + str(obj.Frequency_Sys100NS)) if obj.Name != None: print("Name:" + str(obj.Name)) if obj.Timestamp_Object != None: print("Timestamp_Object:" + str(obj.Timestamp_Object)) if obj.Timestamp_PerfTime != None: print("Timestamp_PerfTime:" + str(obj.Timestamp_PerfTime)) if obj.Timestamp_Sys100NS != None: print("Timestamp_Sys100NS:" + str(obj.Timestamp_Sys100NS)) print("") print("########") print("")