Contact Info

Crumbtrail

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

Win32_PerfFormattedData_WRTCESPf 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_WRTCESPf 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_WRTCESPf_LCUSrv00DBStore')

for obj in objWMI:
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	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.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.USrv000QueueDepth != None:
		print("USrv000QueueDepth:" + str(obj.USrv000QueueDepth))
	if obj.USrv002QueueLatencymsec != None:
		print("USrv002QueueLatencymsec:" + str(obj.USrv002QueueLatencymsec))
	if obj.USrv004SprocLatencymsec != None:
		print("USrv004SprocLatencymsec:" + str(obj.USrv004SprocLatencymsec))
	if obj.USrv006PercentDatabaseTime != None:
		print("USrv006PercentDatabaseTime:" + str(obj.USrv006PercentDatabaseTime))
	if obj.USrv008ThreadsWaitingforNewDatabaseRequests != None:
		print("USrv008ThreadsWaitingforNewDatabaseRequests:" + str(obj.USrv008ThreadsWaitingforNewDatabaseRequests))
	if obj.USrv009ThreadsExecutingDatabaseOperations != None:
		print("USrv009ThreadsExecutingDatabaseOperations:" + str(obj.USrv009ThreadsExecutingDatabaseOperations))
	if obj.USrv010ThreadsCallingBackwithDatabaseResults != None:
		print("USrv010ThreadsCallingBackwithDatabaseResults:" + str(obj.USrv010ThreadsCallingBackwithDatabaseResults))
	if obj.USrv011BlockedClientThreads != None:
		print("USrv011BlockedClientThreads:" + str(obj.USrv011BlockedClientThreads))
	if obj.USrv013TotalDeadlocks != None:
		print("USrv013TotalDeadlocks:" + str(obj.USrv013TotalDeadlocks))
	if obj.USrv014TotalDroppedRequests != None:
		print("USrv014TotalDroppedRequests:" + str(obj.USrv014TotalDroppedRequests))
	if obj.USrv015TotalDeadlockFailures != None:
		print("USrv015TotalDeadlockFailures:" + str(obj.USrv015TotalDeadlockFailures))
	if obj.USrv016TotalTransactionCountMismatchFailures != None:
		print("USrv016TotalTransactionCountMismatchFailures:" + str(obj.USrv016TotalTransactionCountMismatchFailures))
	if obj.USrv017TotalODBCTimeoutFailures != None:
		print("USrv017TotalODBCTimeoutFailures:" + str(obj.USrv017TotalODBCTimeoutFailures))
	if obj.USrv018TotalsevereSQLerrors != None:
		print("USrv018TotalsevereSQLerrors:" + str(obj.USrv018TotalsevereSQLerrors))
	if obj.USrv019TotalfatalSQLerrors != None:
		print("USrv019TotalfatalSQLerrors:" + str(obj.USrv019TotalfatalSQLerrors))
	if obj.USrv020ThrottledrequestsPersec != None:
		print("USrv020ThrottledrequestsPersec:" + str(obj.USrv020ThrottledrequestsPersec))
	if obj.USrv021Totalthrottledrequests != None:
		print("USrv021Totalthrottledrequests:" + str(obj.USrv021Totalthrottledrequests))
	print("")
	print("########")
	print("")