Contact Info

Crumbtrail

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

Win32_PerfFormattedData_MSDTC 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_MSDTC 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_MSDTC_DistributedTransactionCoordinator')

for obj in objWMI:
	if obj.AbortedTransactions != None:
		print("AbortedTransactions:" + str(obj.AbortedTransactions))
	if obj.AbortedTransactionsPersec != None:
		print("AbortedTransactionsPersec:" + str(obj.AbortedTransactionsPersec))
	if obj.ActiveTransactions != None:
		print("ActiveTransactions:" + str(obj.ActiveTransactions))
	if obj.ActiveTransactionsMaximum != None:
		print("ActiveTransactionsMaximum:" + str(obj.ActiveTransactionsMaximum))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CommittedTransactions != None:
		print("CommittedTransactions:" + str(obj.CommittedTransactions))
	if obj.CommittedTransactionsPersec != None:
		print("CommittedTransactionsPersec:" + str(obj.CommittedTransactionsPersec))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.ForceAbortedTransactions != None:
		print("ForceAbortedTransactions:" + str(obj.ForceAbortedTransactions))
	if obj.ForceCommittedTransactions != None:
		print("ForceCommittedTransactions:" + str(obj.ForceCommittedTransactions))
	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.InDoubtTransactions != None:
		print("InDoubtTransactions:" + str(obj.InDoubtTransactions))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.ResponseTimeAverage != None:
		print("ResponseTimeAverage:" + str(obj.ResponseTimeAverage))
	if obj.ResponseTimeMaximum != None:
		print("ResponseTimeMaximum:" + str(obj.ResponseTimeMaximum))
	if obj.ResponseTimeMinimum != None:
		print("ResponseTimeMinimum:" + str(obj.ResponseTimeMinimum))
	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.TransactionsPersec != None:
		print("TransactionsPersec:" + str(obj.TransactionsPersec))
	print("")
	print("########")
	print("")