Contact Info

Crumbtrail

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

Win32_PerfRawData_IAS 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_IAS 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_IAS_NPSAccountingProxy')

for obj in objWMI:
	if obj.AccountingRequests != None:
		print("AccountingRequests:" + str(obj.AccountingRequests))
	if obj.AccountingRequestsPersec != None:
		print("AccountingRequestsPersec:" + str(obj.AccountingRequestsPersec))
	if obj.AccountingResponses != None:
		print("AccountingResponses:" + str(obj.AccountingResponses))
	if obj.AccountingResponsesPersec != None:
		print("AccountingResponsesPersec:" + str(obj.AccountingResponsesPersec))
	if obj.BadAuthenticators != None:
		print("BadAuthenticators:" + str(obj.BadAuthenticators))
	if obj.BadAuthenticatorsPersec != None:
		print("BadAuthenticatorsPersec:" + str(obj.BadAuthenticatorsPersec))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DroppedPackets != None:
		print("DroppedPackets:" + str(obj.DroppedPackets))
	if obj.DroppedPacketsPersec != None:
		print("DroppedPacketsPersec:" + str(obj.DroppedPacketsPersec))
	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.InvalidAddresses != None:
		print("InvalidAddresses:" + str(obj.InvalidAddresses))
	if obj.InvalidAddressesPersec != None:
		print("InvalidAddressesPersec:" + str(obj.InvalidAddressesPersec))
	if obj.MalformedPackets != None:
		print("MalformedPackets:" + str(obj.MalformedPackets))
	if obj.MalformedPacketsPersec != None:
		print("MalformedPacketsPersec:" + str(obj.MalformedPacketsPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.PacketsReceived != None:
		print("PacketsReceived:" + str(obj.PacketsReceived))
	if obj.PacketsReceivedPersec != None:
		print("PacketsReceivedPersec:" + str(obj.PacketsReceivedPersec))
	if obj.PendingRequests != None:
		print("PendingRequests:" + str(obj.PendingRequests))
	if obj.RequestTimeouts != None:
		print("RequestTimeouts:" + str(obj.RequestTimeouts))
	if obj.RequestTimeoutsPersec != None:
		print("RequestTimeoutsPersec:" + str(obj.RequestTimeoutsPersec))
	if obj.Retransmissions != None:
		print("Retransmissions:" + str(obj.Retransmissions))
	if obj.RetransmissionsPersec != None:
		print("RetransmissionsPersec:" + str(obj.RetransmissionsPersec))
	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.UnknownType != None:
		print("UnknownType:" + str(obj.UnknownType))
	if obj.UnknownTypePersec != None:
		print("UnknownTypePersec:" + str(obj.UnknownTypePersec))
	print("")
	print("########")
	print("")