Contact Info

Crumbtrail

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

Win32_PerfFormattedData_usbhub 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_usbhub 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_usbhub_USB')

for obj in objWMI:
	if obj.AvgBytesPerTransfer != None:
		print("AvgBytesPerTransfer:" + str(obj.AvgBytesPerTransfer))
	if obj.AvgmslatencyforISOtransfers != None:
		print("AvgmslatencyforISOtransfers:" + str(obj.AvgmslatencyforISOtransfers))
	if obj.BulkBytesPerSec != None:
		print("BulkBytesPerSec:" + str(obj.BulkBytesPerSec))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.ControlDataBytesPerSec != None:
		print("ControlDataBytesPerSec:" + str(obj.ControlDataBytesPerSec))
	if obj.ControllerPCIInterruptsPerSec != None:
		print("ControllerPCIInterruptsPerSec:" + str(obj.ControllerPCIInterruptsPerSec))
	if obj.ControllerWorkSignalsPerSec != None:
		print("ControllerWorkSignalsPerSec:" + str(obj.ControllerWorkSignalsPerSec))
	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.HostControllerAsyncCacheFlushCount != None:
		print("HostControllerAsyncCacheFlushCount:" + str(obj.HostControllerAsyncCacheFlushCount))
	if obj.HostControllerAsyncIdle != None:
		print("HostControllerAsyncIdle:" + str(obj.HostControllerAsyncIdle))
	if obj.HostControllerIdle != None:
		print("HostControllerIdle:" + str(obj.HostControllerIdle))
	if obj.HostControllerPeriodicCacheFlushCount != None:
		print("HostControllerPeriodicCacheFlushCount:" + str(obj.HostControllerPeriodicCacheFlushCount))
	if obj.HostControllerPeriodicIdle != None:
		print("HostControllerPeriodicIdle:" + str(obj.HostControllerPeriodicIdle))
	if obj.InterruptBytesPerSec != None:
		print("InterruptBytesPerSec:" + str(obj.InterruptBytesPerSec))
	if obj.IsochronousBytesPerSec != None:
		print("IsochronousBytesPerSec:" + str(obj.IsochronousBytesPerSec))
	if obj.IsoPacketErrorsPerSec != None:
		print("IsoPacketErrorsPerSec:" + str(obj.IsoPacketErrorsPerSec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.PercentTotalBandwidthUsedforInterrupt != None:
		print("PercentTotalBandwidthUsedforInterrupt:" + str(obj.PercentTotalBandwidthUsedforInterrupt))
	if obj.PercentTotalBandwidthUsedforIso != None:
		print("PercentTotalBandwidthUsedforIso:" + str(obj.PercentTotalBandwidthUsedforIso))
	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))
	if obj.TransferErrorsPerSec != None:
		print("TransferErrorsPerSec:" + str(obj.TransferErrorsPerSec))
	print("")
	print("########")
	print("")