Contact Info

Crumbtrail

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

Win32_PerfFormattedData_ASPNET 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_ASPNET 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_ASPNET_ASPNET')

for obj in objWMI:
	if obj.ApplicationRestarts != None:
		print("ApplicationRestarts:" + str(obj.ApplicationRestarts))
	if obj.ApplicationsRunning != None:
		print("ApplicationsRunning:" + str(obj.ApplicationsRunning))
	if obj.AuditFailureEventsRaised != None:
		print("AuditFailureEventsRaised:" + str(obj.AuditFailureEventsRaised))
	if obj.AuditSuccessEventsRaised != None:
		print("AuditSuccessEventsRaised:" + str(obj.AuditSuccessEventsRaised))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.ErrorEventsRaised != None:
		print("ErrorEventsRaised:" + str(obj.ErrorEventsRaised))
	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.InfrastructureErrorEventsRaised != None:
		print("InfrastructureErrorEventsRaised:" + str(obj.InfrastructureErrorEventsRaised))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.RequestErrorEventsRaised != None:
		print("RequestErrorEventsRaised:" + str(obj.RequestErrorEventsRaised))
	if obj.RequestExecutionTime != None:
		print("RequestExecutionTime:" + str(obj.RequestExecutionTime))
	if obj.RequestsCurrent != None:
		print("RequestsCurrent:" + str(obj.RequestsCurrent))
	if obj.RequestsDisconnected != None:
		print("RequestsDisconnected:" + str(obj.RequestsDisconnected))
	if obj.RequestsInNativeQueue != None:
		print("RequestsInNativeQueue:" + str(obj.RequestsInNativeQueue))
	if obj.RequestsQueued != None:
		print("RequestsQueued:" + str(obj.RequestsQueued))
	if obj.RequestsRejected != None:
		print("RequestsRejected:" + str(obj.RequestsRejected))
	if obj.RequestWaitTime != None:
		print("RequestWaitTime:" + str(obj.RequestWaitTime))
	if obj.StateServerSessionsAbandoned != None:
		print("StateServerSessionsAbandoned:" + str(obj.StateServerSessionsAbandoned))
	if obj.StateServerSessionsActive != None:
		print("StateServerSessionsActive:" + str(obj.StateServerSessionsActive))
	if obj.StateServerSessionsTimedOut != None:
		print("StateServerSessionsTimedOut:" + str(obj.StateServerSessionsTimedOut))
	if obj.StateServerSessionsTotal != None:
		print("StateServerSessionsTotal:" + str(obj.StateServerSessionsTotal))
	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.WorkerProcessesRunning != None:
		print("WorkerProcessesRunning:" + str(obj.WorkerProcessesRunning))
	if obj.WorkerProcessRestarts != None:
		print("WorkerProcessRestarts:" + str(obj.WorkerProcessRestarts))
	print("")
	print("########")
	print("")