Contact Info

Crumbtrail

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

Win32_PerfRawData_ServiceModelService3000 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_ServiceModelService3000 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_ServiceModelService3000_ServiceModelService3000')

for obj in objWMI:
	if obj.Calls != None:
		print("Calls:" + str(obj.Calls))
	if obj.CallsDuration != None:
		print("CallsDuration:" + str(obj.CallsDuration))
	if obj.CallsDuration_Base != None:
		print("CallsDuration_Base:" + str(obj.CallsDuration_Base))
	if obj.CallsFailed != None:
		print("CallsFailed:" + str(obj.CallsFailed))
	if obj.CallsFailedPerSecond != None:
		print("CallsFailedPerSecond:" + str(obj.CallsFailedPerSecond))
	if obj.CallsFaulted != None:
		print("CallsFaulted:" + str(obj.CallsFaulted))
	if obj.CallsFaultedPerSecond != None:
		print("CallsFaultedPerSecond:" + str(obj.CallsFaultedPerSecond))
	if obj.CallsOutstanding != None:
		print("CallsOutstanding:" + str(obj.CallsOutstanding))
	if obj.CallsPerSecond != None:
		print("CallsPerSecond:" + str(obj.CallsPerSecond))
	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.Instances != None:
		print("Instances:" + str(obj.Instances))
	if obj.InstancesCreatedPerSecond != None:
		print("InstancesCreatedPerSecond:" + str(obj.InstancesCreatedPerSecond))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.QueuedMessagesDropped != None:
		print("QueuedMessagesDropped:" + str(obj.QueuedMessagesDropped))
	if obj.QueuedMessagesDroppedPerSecond != None:
		print("QueuedMessagesDroppedPerSecond:" + str(obj.QueuedMessagesDroppedPerSecond))
	if obj.QueuedMessagesRejected != None:
		print("QueuedMessagesRejected:" + str(obj.QueuedMessagesRejected))
	if obj.QueuedMessagesRejectedPerSecond != None:
		print("QueuedMessagesRejectedPerSecond:" + str(obj.QueuedMessagesRejectedPerSecond))
	if obj.QueuedPoisonMessages != None:
		print("QueuedPoisonMessages:" + str(obj.QueuedPoisonMessages))
	if obj.QueuedPoisonMessagesPerSecond != None:
		print("QueuedPoisonMessagesPerSecond:" + str(obj.QueuedPoisonMessagesPerSecond))
	if obj.ReliableMessagingMessagesDropped != None:
		print("ReliableMessagingMessagesDropped:" + str(obj.ReliableMessagingMessagesDropped))
	if obj.ReliableMessagingMessagesDroppedPerSecond != None:
		print("ReliableMessagingMessagesDroppedPerSecond:" + str(obj.ReliableMessagingMessagesDroppedPerSecond))
	if obj.ReliableMessagingSessionsFaulted != None:
		print("ReliableMessagingSessionsFaulted:" + str(obj.ReliableMessagingSessionsFaulted))
	if obj.ReliableMessagingSessionsFaultedPerSecond != None:
		print("ReliableMessagingSessionsFaultedPerSecond:" + str(obj.ReliableMessagingSessionsFaultedPerSecond))
	if obj.SecurityCallsNotAuthorized != None:
		print("SecurityCallsNotAuthorized:" + str(obj.SecurityCallsNotAuthorized))
	if obj.SecurityCallsNotAuthorizedPerSecond != None:
		print("SecurityCallsNotAuthorizedPerSecond:" + str(obj.SecurityCallsNotAuthorizedPerSecond))
	if obj.SecurityValidationandAuthenticationFailures != None:
		print("SecurityValidationandAuthenticationFailures:" + str(obj.SecurityValidationandAuthenticationFailures))
	if obj.SecurityValidationandAuthenticationFailuresPerSecond != None:
		print("SecurityValidationandAuthenticationFailuresPerSecond:" + str(obj.SecurityValidationandAuthenticationFailuresPerSecond))
	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.TransactedOperationsAborted != None:
		print("TransactedOperationsAborted:" + str(obj.TransactedOperationsAborted))
	if obj.TransactedOperationsAbortedPerSecond != None:
		print("TransactedOperationsAbortedPerSecond:" + str(obj.TransactedOperationsAbortedPerSecond))
	if obj.TransactedOperationsCommitted != None:
		print("TransactedOperationsCommitted:" + str(obj.TransactedOperationsCommitted))
	if obj.TransactedOperationsCommittedPerSecond != None:
		print("TransactedOperationsCommittedPerSecond:" + str(obj.TransactedOperationsCommittedPerSecond))
	if obj.TransactedOperationsInDoubt != None:
		print("TransactedOperationsInDoubt:" + str(obj.TransactedOperationsInDoubt))
	if obj.TransactedOperationsInDoubtPerSecond != None:
		print("TransactedOperationsInDoubtPerSecond:" + str(obj.TransactedOperationsInDoubtPerSecond))
	if obj.TransactionsFlowed != None:
		print("TransactionsFlowed:" + str(obj.TransactionsFlowed))
	if obj.TransactionsFlowedPerSecond != None:
		print("TransactionsFlowedPerSecond:" + str(obj.TransactionsFlowedPerSecond))
	print("")
	print("########")
	print("")