Contact Info

Crumbtrail

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

Win32_PerfRawData_ReportServer 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_ReportServer 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_ReportServer_ReportServerService')

for obj in objWMI:
	if obj.ActiveConnections != None:
		print("ActiveConnections:" + str(obj.ActiveConnections))
	if obj.BytesReceivedPersec != None:
		print("BytesReceivedPersec:" + str(obj.BytesReceivedPersec))
	if obj.BytesReceivedTotal != None:
		print("BytesReceivedTotal:" + str(obj.BytesReceivedTotal))
	if obj.BytesSentPersec != None:
		print("BytesSentPersec:" + str(obj.BytesSentPersec))
	if obj.BytesSentTotal != None:
		print("BytesSentTotal:" + str(obj.BytesSentTotal))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.ErrorsPersec != None:
		print("ErrorsPersec:" + str(obj.ErrorsPersec))
	if obj.ErrorsTotal != None:
		print("ErrorsTotal:" + str(obj.ErrorsTotal))
	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.LogonAttemptsPersec != None:
		print("LogonAttemptsPersec:" + str(obj.LogonAttemptsPersec))
	if obj.LogonAttemptsTotal != None:
		print("LogonAttemptsTotal:" + str(obj.LogonAttemptsTotal))
	if obj.LogonSuccessesPersec != None:
		print("LogonSuccessesPersec:" + str(obj.LogonSuccessesPersec))
	if obj.LogonSuccessesTotal != None:
		print("LogonSuccessesTotal:" + str(obj.LogonSuccessesTotal))
	if obj.MemoryPressureState != None:
		print("MemoryPressureState:" + str(obj.MemoryPressureState))
	if obj.MemoryShrinkAmount != None:
		print("MemoryShrinkAmount:" + str(obj.MemoryShrinkAmount))
	if obj.MemoryShrinkNotificationsPersec != None:
		print("MemoryShrinkNotificationsPersec:" + str(obj.MemoryShrinkNotificationsPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.RequestsDisconnected != None:
		print("RequestsDisconnected:" + str(obj.RequestsDisconnected))
	if obj.RequestsExecuting != None:
		print("RequestsExecuting:" + str(obj.RequestsExecuting))
	if obj.RequestsNotAuthorized != None:
		print("RequestsNotAuthorized:" + str(obj.RequestsNotAuthorized))
	if obj.RequestsPersec != None:
		print("RequestsPersec:" + str(obj.RequestsPersec))
	if obj.RequestsRejected != None:
		print("RequestsRejected:" + str(obj.RequestsRejected))
	if obj.RequestsTotal != None:
		print("RequestsTotal:" + str(obj.RequestsTotal))
	if obj.TasksQueued != None:
		print("TasksQueued:" + str(obj.TasksQueued))
	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("")