Contact Info

Crumbtrail » Administration » Scripts » WMI » python sample

Win32_PerfRawData_RemoteAccess 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_RemoteAccess 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_RemoteAccess_RASPort')

for obj in objWMI:
	if obj.AlignmentErrors != None:
		print("AlignmentErrors:" + str(obj.AlignmentErrors))
	if obj.BufferOverrunErrors != None:
		print("BufferOverrunErrors:" + str(obj.BufferOverrunErrors))
	if obj.BytesReceived != None:
		print("BytesReceived:" + str(obj.BytesReceived))
	if obj.BytesReceivedPerSec != None:
		print("BytesReceivedPerSec:" + str(obj.BytesReceivedPerSec))
	if obj.BytesTransmitted != None:
		print("BytesTransmitted:" + str(obj.BytesTransmitted))
	if obj.BytesTransmittedPerSec != None:
		print("BytesTransmittedPerSec:" + str(obj.BytesTransmittedPerSec))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CRCErrors != None:
		print("CRCErrors:" + str(obj.CRCErrors))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.FramesReceived != None:
		print("FramesReceived:" + str(obj.FramesReceived))
	if obj.FramesReceivedPerSec != None:
		print("FramesReceivedPerSec:" + str(obj.FramesReceivedPerSec))
	if obj.FramesTransmitted != None:
		print("FramesTransmitted:" + str(obj.FramesTransmitted))
	if obj.FramesTransmittedPerSec != None:
		print("FramesTransmittedPerSec:" + str(obj.FramesTransmittedPerSec))
	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.PercentCompressionIn != None:
		print("PercentCompressionIn:" + str(obj.PercentCompressionIn))
	if obj.PercentCompressionOut != None:
		print("PercentCompressionOut:" + str(obj.PercentCompressionOut))
	if obj.SerialOverrunErrors != None:
		print("SerialOverrunErrors:" + str(obj.SerialOverrunErrors))
	if obj.TimeoutErrors != None:
		print("TimeoutErrors:" + str(obj.TimeoutErrors))
	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.TotalErrors != None:
		print("TotalErrors:" + str(obj.TotalErrors))
	if obj.TotalErrorsPerSec != None:
		print("TotalErrorsPerSec:" + str(obj.TotalErrorsPerSec))