Contact Info

Crumbtrail

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

Win32_PerfRawData_PSched 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_PerfRawData_PSched 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_PerfRawData_PSched_PacerPipe')

for obj in objWMI:
	if obj.Averagepacketsinnetcard != None:
		print("Averagepacketsinnetcard:" + str(obj.Averagepacketsinnetcard))
	if obj.Averagepacketsinsequencer != None:
		print("Averagepacketsinsequencer:" + str(obj.Averagepacketsinsequencer))
	if obj.Averagepacketsinshaper != None:
		print("Averagepacketsinshaper:" + str(obj.Averagepacketsinshaper))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.Flowmodsrejected != None:
		print("Flowmodsrejected:" + str(obj.Flowmodsrejected))
	if obj.Flowsclosed != None:
		print("Flowsclosed:" + str(obj.Flowsclosed))
	if obj.Flowsmodified != None:
		print("Flowsmodified:" + str(obj.Flowsmodified))
	if obj.Flowsopened != None:
		print("Flowsopened:" + str(obj.Flowsopened))
	if obj.Flowsrejected != None:
		print("Flowsrejected:" + str(obj.Flowsrejected))
	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.Maxpacketsinnetcard != None:
		print("Maxpacketsinnetcard:" + str(obj.Maxpacketsinnetcard))
	if obj.Maxpacketsinsequencer != None:
		print("Maxpacketsinsequencer:" + str(obj.Maxpacketsinsequencer))
	if obj.Maxpacketsinshaper != None:
		print("Maxpacketsinshaper:" + str(obj.Maxpacketsinshaper))
	if obj.Maxsimultaneousflows != None:
		print("Maxsimultaneousflows:" + str(obj.Maxsimultaneousflows))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.Nonconformingpacketsscheduled != None:
		print("Nonconformingpacketsscheduled:" + str(obj.Nonconformingpacketsscheduled))
	if obj.NonconformingpacketsscheduledPersec != None:
		print("NonconformingpacketsscheduledPersec:" + str(obj.NonconformingpacketsscheduledPersec))
	if obj.Nonconformingpacketstransmitted != None:
		print("Nonconformingpacketstransmitted:" + str(obj.Nonconformingpacketstransmitted))
	if obj.NonconformingpacketstransmittedPersec != None:
		print("NonconformingpacketstransmittedPersec:" + str(obj.NonconformingpacketstransmittedPersec))
	if obj.Outofpackets != None:
		print("Outofpackets:" + str(obj.Outofpackets))
	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("")