Contact Info

Crumbtrail

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

Win32_PerfRawData_ASPNET2050727 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_ASPNET2050727 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_ASPNET2050727_ASPNETAppsv2050727')

for obj in objWMI:
	if obj.AnonymousRequests != None:
		print("AnonymousRequests:" + str(obj.AnonymousRequests))
	if obj.AnonymousRequestsPerSec != None:
		print("AnonymousRequestsPerSec:" + str(obj.AnonymousRequestsPerSec))
	if obj.ApplicationLifetimeEvents != None:
		print("ApplicationLifetimeEvents:" + str(obj.ApplicationLifetimeEvents))
	if obj.ApplicationLifetimeEventsPerSec != None:
		print("ApplicationLifetimeEventsPerSec:" + str(obj.ApplicationLifetimeEventsPerSec))
	if obj.AuditFailureEventsRaised != None:
		print("AuditFailureEventsRaised:" + str(obj.AuditFailureEventsRaised))
	if obj.AuditSuccessEventsRaised != None:
		print("AuditSuccessEventsRaised:" + str(obj.AuditSuccessEventsRaised))
	if obj.CacheAPIEntries != None:
		print("CacheAPIEntries:" + str(obj.CacheAPIEntries))
	if obj.CacheAPIHitRatio != None:
		print("CacheAPIHitRatio:" + str(obj.CacheAPIHitRatio))
	if obj.CacheAPIHitRatio_Base != None:
		print("CacheAPIHitRatio_Base:" + str(obj.CacheAPIHitRatio_Base))
	if obj.CacheAPIHits != None:
		print("CacheAPIHits:" + str(obj.CacheAPIHits))
	if obj.CacheAPIMisses != None:
		print("CacheAPIMisses:" + str(obj.CacheAPIMisses))
	if obj.CacheAPITrims != None:
		print("CacheAPITrims:" + str(obj.CacheAPITrims))
	if obj.CacheAPITurnoverRate != None:
		print("CacheAPITurnoverRate:" + str(obj.CacheAPITurnoverRate))
	if obj.CachePercentMachineMemoryLimitUsed != None:
		print("CachePercentMachineMemoryLimitUsed:" + str(obj.CachePercentMachineMemoryLimitUsed))
	if obj.CachePercentMachineMemoryLimitUsed_Base != None:
		print("CachePercentMachineMemoryLimitUsed_Base:" + str(obj.CachePercentMachineMemoryLimitUsed_Base))
	if obj.CachePercentProcessMemoryLimitUsed != None:
		print("CachePercentProcessMemoryLimitUsed:" + str(obj.CachePercentProcessMemoryLimitUsed))
	if obj.CachePercentProcessMemoryLimitUsed_Base != None:
		print("CachePercentProcessMemoryLimitUsed_Base:" + str(obj.CachePercentProcessMemoryLimitUsed_Base))
	if obj.CacheTotalEntries != None:
		print("CacheTotalEntries:" + str(obj.CacheTotalEntries))
	if obj.CacheTotalHitRatio != None:
		print("CacheTotalHitRatio:" + str(obj.CacheTotalHitRatio))
	if obj.CacheTotalHitRatio_Base != None:
		print("CacheTotalHitRatio_Base:" + str(obj.CacheTotalHitRatio_Base))
	if obj.CacheTotalHits != None:
		print("CacheTotalHits:" + str(obj.CacheTotalHits))
	if obj.CacheTotalMisses != None:
		print("CacheTotalMisses:" + str(obj.CacheTotalMisses))
	if obj.CacheTotalTrims != None:
		print("CacheTotalTrims:" + str(obj.CacheTotalTrims))
	if obj.CacheTotalTurnoverRate != None:
		print("CacheTotalTurnoverRate:" + str(obj.CacheTotalTurnoverRate))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CompilationsTotal != None:
		print("CompilationsTotal:" + str(obj.CompilationsTotal))
	if obj.DebuggingRequests != None:
		print("DebuggingRequests:" + str(obj.DebuggingRequests))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.ErrorEventsRaised != None:
		print("ErrorEventsRaised:" + str(obj.ErrorEventsRaised))
	if obj.ErrorEventsRaisedPerSec != None:
		print("ErrorEventsRaisedPerSec:" + str(obj.ErrorEventsRaisedPerSec))
	if obj.ErrorsDuringCompilation != None:
		print("ErrorsDuringCompilation:" + str(obj.ErrorsDuringCompilation))
	if obj.ErrorsDuringExecution != None:
		print("ErrorsDuringExecution:" + str(obj.ErrorsDuringExecution))
	if obj.ErrorsDuringPreprocessing != None:
		print("ErrorsDuringPreprocessing:" + str(obj.ErrorsDuringPreprocessing))
	if obj.ErrorsTotal != None:
		print("ErrorsTotal:" + str(obj.ErrorsTotal))
	if obj.ErrorsTotalPerSec != None:
		print("ErrorsTotalPerSec:" + str(obj.ErrorsTotalPerSec))
	if obj.ErrorsUnhandledDuringExecution != None:
		print("ErrorsUnhandledDuringExecution:" + str(obj.ErrorsUnhandledDuringExecution))
	if obj.ErrorsUnhandledDuringExecutionPerSec != None:
		print("ErrorsUnhandledDuringExecutionPerSec:" + str(obj.ErrorsUnhandledDuringExecutionPerSec))
	if obj.EventsRaised != None:
		print("EventsRaised:" + str(obj.EventsRaised))
	if obj.EventsRaisedPerSec != None:
		print("EventsRaisedPerSec:" + str(obj.EventsRaisedPerSec))
	if obj.FormsAuthenticationFailure != None:
		print("FormsAuthenticationFailure:" + str(obj.FormsAuthenticationFailure))
	if obj.FormsAuthenticationSuccess != None:
		print("FormsAuthenticationSuccess:" + str(obj.FormsAuthenticationSuccess))
	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.InfrastructureErrorEventsRaisedPerSec != None:
		print("InfrastructureErrorEventsRaisedPerSec:" + str(obj.InfrastructureErrorEventsRaisedPerSec))
	if obj.MembershipAuthenticationFailure != None:
		print("MembershipAuthenticationFailure:" + str(obj.MembershipAuthenticationFailure))
	if obj.MembershipAuthenticationSuccess != None:
		print("MembershipAuthenticationSuccess:" + str(obj.MembershipAuthenticationSuccess))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.OutputCacheEntries != None:
		print("OutputCacheEntries:" + str(obj.OutputCacheEntries))
	if obj.OutputCacheHitRatio != None:
		print("OutputCacheHitRatio:" + str(obj.OutputCacheHitRatio))
	if obj.OutputCacheHitRatio_Base != None:
		print("OutputCacheHitRatio_Base:" + str(obj.OutputCacheHitRatio_Base))
	if obj.OutputCacheHits != None:
		print("OutputCacheHits:" + str(obj.OutputCacheHits))
	if obj.OutputCacheMisses != None:
		print("OutputCacheMisses:" + str(obj.OutputCacheMisses))
	if obj.OutputCacheTrims != None:
		print("OutputCacheTrims:" + str(obj.OutputCacheTrims))
	if obj.OutputCacheTurnoverRate != None:
		print("OutputCacheTurnoverRate:" + str(obj.OutputCacheTurnoverRate))
	if obj.PipelineInstanceCount != None:
		print("PipelineInstanceCount:" + str(obj.PipelineInstanceCount))
	if obj.RequestBytesInTotal != None:
		print("RequestBytesInTotal:" + str(obj.RequestBytesInTotal))
	if obj.RequestBytesOutTotal != None:
		print("RequestBytesOutTotal:" + str(obj.RequestBytesOutTotal))
	if obj.RequestErrorEventsRaised != None:
		print("RequestErrorEventsRaised:" + str(obj.RequestErrorEventsRaised))
	if obj.RequestErrorEventsRaisedPerSec != None:
		print("RequestErrorEventsRaisedPerSec:" + str(obj.RequestErrorEventsRaisedPerSec))
	if obj.RequestEventsRaised != None:
		print("RequestEventsRaised:" + str(obj.RequestEventsRaised))
	if obj.RequestEventsRaisedPerSec != None:
		print("RequestEventsRaisedPerSec:" + str(obj.RequestEventsRaisedPerSec))
	if obj.RequestExecutionTime != None:
		print("RequestExecutionTime:" + str(obj.RequestExecutionTime))
	if obj.RequestsDisconnected != None:
		print("RequestsDisconnected:" + str(obj.RequestsDisconnected))
	if obj.RequestsExecuting != None:
		print("RequestsExecuting:" + str(obj.RequestsExecuting))
	if obj.RequestsFailed != None:
		print("RequestsFailed:" + str(obj.RequestsFailed))
	if obj.RequestsInApplicationQueue != None:
		print("RequestsInApplicationQueue:" + str(obj.RequestsInApplicationQueue))
	if obj.RequestsNotAuthorized != None:
		print("RequestsNotAuthorized:" + str(obj.RequestsNotAuthorized))
	if obj.RequestsNotFound != None:
		print("RequestsNotFound:" + str(obj.RequestsNotFound))
	if obj.RequestsPerSec != None:
		print("RequestsPerSec:" + str(obj.RequestsPerSec))
	if obj.RequestsRejected != None:
		print("RequestsRejected:" + str(obj.RequestsRejected))
	if obj.RequestsSucceeded != None:
		print("RequestsSucceeded:" + str(obj.RequestsSucceeded))
	if obj.RequestsTimedOut != None:
		print("RequestsTimedOut:" + str(obj.RequestsTimedOut))
	if obj.RequestsTotal != None:
		print("RequestsTotal:" + str(obj.RequestsTotal))
	if obj.RequestWaitTime != None:
		print("RequestWaitTime:" + str(obj.RequestWaitTime))
	if obj.SessionsAbandoned != None:
		print("SessionsAbandoned:" + str(obj.SessionsAbandoned))
	if obj.SessionsActive != None:
		print("SessionsActive:" + str(obj.SessionsActive))
	if obj.SessionSQLServerconnectionstotal != None:
		print("SessionSQLServerconnectionstotal:" + str(obj.SessionSQLServerconnectionstotal))
	if obj.SessionStateServerconnectionstotal != None:
		print("SessionStateServerconnectionstotal:" + str(obj.SessionStateServerconnectionstotal))
	if obj.SessionsTimedOut != None:
		print("SessionsTimedOut:" + str(obj.SessionsTimedOut))
	if obj.SessionsTotal != None:
		print("SessionsTotal:" + str(obj.SessionsTotal))
	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.TransactionsAborted != None:
		print("TransactionsAborted:" + str(obj.TransactionsAborted))
	if obj.TransactionsCommitted != None:
		print("TransactionsCommitted:" + str(obj.TransactionsCommitted))
	if obj.TransactionsPending != None:
		print("TransactionsPending:" + str(obj.TransactionsPending))
	if obj.TransactionsPerSec != None:
		print("TransactionsPerSec:" + str(obj.TransactionsPerSec))
	if obj.TransactionsTotal != None:
		print("TransactionsTotal:" + str(obj.TransactionsTotal))
	if obj.ViewstateMACValidationFailure != None:
		print("ViewstateMACValidationFailure:" + str(obj.ViewstateMACValidationFailure))
	print("")
	print("########")
	print("")