Contact Info

Crumbtrail

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

Win32_PerfFormattedData_UGTHRSVC 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_UGTHRSVC 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_UGTHRSVC_SearchGatherer')

for obj in objWMI:
	if obj.ActiveQueueLength != None:
		print("ActiveQueueLength:" + str(obj.ActiveQueueLength))
	if obj.AdminClients != None:
		print("AdminClients:" + str(obj.AdminClients))
	if obj.AllNotificationsReceived != None:
		print("AllNotificationsReceived:" + str(obj.AllNotificationsReceived))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.DelayedDocuments != None:
		print("DelayedDocuments:" + str(obj.DelayedDocuments))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DocumentEntries != None:
		print("DocumentEntries:" + str(obj.DocumentEntries))
	if obj.DocumentsDelayedRetry != None:
		print("DocumentsDelayedRetry:" + str(obj.DocumentsDelayedRetry))
	if obj.DocumentsFiltered != None:
		print("DocumentsFiltered:" + str(obj.DocumentsFiltered))
	if obj.DocumentsFilteredRate != None:
		print("DocumentsFilteredRate:" + str(obj.DocumentsFilteredRate))
	if obj.DocumentsSuccessfullyFiltered != None:
		print("DocumentsSuccessfullyFiltered:" + str(obj.DocumentsSuccessfullyFiltered))
	if obj.DocumentsSuccessfullyFilteredRate != None:
		print("DocumentsSuccessfullyFilteredRate:" + str(obj.DocumentsSuccessfullyFilteredRate))
	if obj.ExtNotificationsRate != None:
		print("ExtNotificationsRate:" + str(obj.ExtNotificationsRate))
	if obj.ExtNotificationsReceived != None:
		print("ExtNotificationsReceived:" + str(obj.ExtNotificationsReceived))
	if obj.FilteringThreads != None:
		print("FilteringThreads:" + str(obj.FilteringThreads))
	if obj.FilterObjects != None:
		print("FilterObjects:" + str(obj.FilterObjects))
	if obj.FilterProcessCreated != None:
		print("FilterProcessCreated:" + str(obj.FilterProcessCreated))
	if obj.FilterProcesses != None:
		print("FilterProcesses:" + str(obj.FilterProcesses))
	if obj.FilterProcessesMax != None:
		print("FilterProcessesMax:" + str(obj.FilterProcessesMax))
	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.Heartbeats != None:
		print("Heartbeats:" + str(obj.Heartbeats))
	if obj.HeartbeatsRate != None:
		print("HeartbeatsRate:" + str(obj.HeartbeatsRate))
	if obj.IdleThreads != None:
		print("IdleThreads:" + str(obj.IdleThreads))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.NotificationSources != None:
		print("NotificationSources:" + str(obj.NotificationSources))
	if obj.NotificationsRate != None:
		print("NotificationsRate:" + str(obj.NotificationsRate))
	if obj.PerformanceLevel != None:
		print("PerformanceLevel:" + str(obj.PerformanceLevel))
	if obj.Reasontobackoff != None:
		print("Reasontobackoff:" + str(obj.Reasontobackoff))
	if obj.ServerObjects != None:
		print("ServerObjects:" + str(obj.ServerObjects))
	if obj.ServerObjectsCreated != None:
		print("ServerObjectsCreated:" + str(obj.ServerObjectsCreated))
	if obj.ServersCurrentlyUnavailable != None:
		print("ServersCurrentlyUnavailable:" + str(obj.ServersCurrentlyUnavailable))
	if obj.ServersUnavailable != None:
		print("ServersUnavailable:" + str(obj.ServersUnavailable))
	if obj.StemmersCached != None:
		print("StemmersCached:" + str(obj.StemmersCached))
	if obj.SystemIOtrafficrate != None:
		print("SystemIOtrafficrate:" + str(obj.SystemIOtrafficrate))
	if obj.ThreadsAccessingNetwork != None:
		print("ThreadsAccessingNetwork:" + str(obj.ThreadsAccessingNetwork))
	if obj.Threadsblockedduetobackoff != None:
		print("Threadsblockedduetobackoff:" + str(obj.Threadsblockedduetobackoff))
	if obj.ThreadsInPlugins != None:
		print("ThreadsInPlugins:" + str(obj.ThreadsInPlugins))
	if obj.TimeOuts != None:
		print("TimeOuts:" + str(obj.TimeOuts))
	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.WordBreakersCached != None:
		print("WordBreakersCached:" + str(obj.WordBreakersCached))
	print("")
	print("########")
	print("")