Contact Info

Crumbtrail

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

Win32_PerfFormattedData_MSSQLSERVER 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_MSSQLSERVER 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_MSSQLSERVER_SQLServerAccessMethods')

for obj in objWMI:
	if obj.AUcleanupbatchesPersec != None:
		print("AUcleanupbatchesPersec:" + str(obj.AUcleanupbatchesPersec))
	if obj.AUcleanupsPersec != None:
		print("AUcleanupsPersec:" + str(obj.AUcleanupsPersec))
	if obj.ByreferenceLobCreateCount != None:
		print("ByreferenceLobCreateCount:" + str(obj.ByreferenceLobCreateCount))
	if obj.ByreferenceLobUseCount != None:
		print("ByreferenceLobUseCount:" + str(obj.ByreferenceLobUseCount))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CountLobReadahead != None:
		print("CountLobReadahead:" + str(obj.CountLobReadahead))
	if obj.CountPullInRow != None:
		print("CountPullInRow:" + str(obj.CountPullInRow))
	if obj.CountPushOffRow != None:
		print("CountPushOffRow:" + str(obj.CountPushOffRow))
	if obj.DeferreddroppedAUs != None:
		print("DeferreddroppedAUs:" + str(obj.DeferreddroppedAUs))
	if obj.DeferredDroppedrowsets != None:
		print("DeferredDroppedrowsets:" + str(obj.DeferredDroppedrowsets))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DroppedrowsetcleanupsPersec != None:
		print("DroppedrowsetcleanupsPersec:" + str(obj.DroppedrowsetcleanupsPersec))
	if obj.DroppedrowsetsskippedPersec != None:
		print("DroppedrowsetsskippedPersec:" + str(obj.DroppedrowsetsskippedPersec))
	if obj.ExtentDeallocationsPersec != None:
		print("ExtentDeallocationsPersec:" + str(obj.ExtentDeallocationsPersec))
	if obj.ExtentsAllocatedPersec != None:
		print("ExtentsAllocatedPersec:" + str(obj.ExtentsAllocatedPersec))
	if obj.FailedAUcleanupbatchesPersec != None:
		print("FailedAUcleanupbatchesPersec:" + str(obj.FailedAUcleanupbatchesPersec))
	if obj.Failedleafpagecookie != None:
		print("Failedleafpagecookie:" + str(obj.Failedleafpagecookie))
	if obj.Failedtreepagecookie != None:
		print("Failedtreepagecookie:" + str(obj.Failedtreepagecookie))
	if obj.ForwardedRecordsPersec != None:
		print("ForwardedRecordsPersec:" + str(obj.ForwardedRecordsPersec))
	if obj.FreeSpacePageFetchesPersec != None:
		print("FreeSpacePageFetchesPersec:" + str(obj.FreeSpacePageFetchesPersec))
	if obj.FreeSpaceScansPersec != None:
		print("FreeSpaceScansPersec:" + str(obj.FreeSpaceScansPersec))
	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.FullScansPersec != None:
		print("FullScansPersec:" + str(obj.FullScansPersec))
	if obj.IndexSearchesPersec != None:
		print("IndexSearchesPersec:" + str(obj.IndexSearchesPersec))
	if obj.LobHandleCreateCount != None:
		print("LobHandleCreateCount:" + str(obj.LobHandleCreateCount))
	if obj.LobHandleDestroyCount != None:
		print("LobHandleDestroyCount:" + str(obj.LobHandleDestroyCount))
	if obj.LobSSProviderCreateCount != None:
		print("LobSSProviderCreateCount:" + str(obj.LobSSProviderCreateCount))
	if obj.LobSSProviderDestroyCount != None:
		print("LobSSProviderDestroyCount:" + str(obj.LobSSProviderDestroyCount))
	if obj.LobSSProviderTruncationCount != None:
		print("LobSSProviderTruncationCount:" + str(obj.LobSSProviderTruncationCount))
	if obj.MixedpageallocationsPersec != None:
		print("MixedpageallocationsPersec:" + str(obj.MixedpageallocationsPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.PagecompressionattemptsPersec != None:
		print("PagecompressionattemptsPersec:" + str(obj.PagecompressionattemptsPersec))
	if obj.PageDeallocationsPersec != None:
		print("PageDeallocationsPersec:" + str(obj.PageDeallocationsPersec))
	if obj.PagesAllocatedPersec != None:
		print("PagesAllocatedPersec:" + str(obj.PagesAllocatedPersec))
	if obj.PagescompressedPersec != None:
		print("PagescompressedPersec:" + str(obj.PagescompressedPersec))
	if obj.PageSplitsPersec != None:
		print("PageSplitsPersec:" + str(obj.PageSplitsPersec))
	if obj.ProbeScansPersec != None:
		print("ProbeScansPersec:" + str(obj.ProbeScansPersec))
	if obj.RangeScansPersec != None:
		print("RangeScansPersec:" + str(obj.RangeScansPersec))
	if obj.ScanPointRevalidationsPersec != None:
		print("ScanPointRevalidationsPersec:" + str(obj.ScanPointRevalidationsPersec))
	if obj.SkippedGhostedRecordsPersec != None:
		print("SkippedGhostedRecordsPersec:" + str(obj.SkippedGhostedRecordsPersec))
	if obj.TableLockEscalationsPersec != None:
		print("TableLockEscalationsPersec:" + str(obj.TableLockEscalationsPersec))
	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.Usedleafpagecookie != None:
		print("Usedleafpagecookie:" + str(obj.Usedleafpagecookie))
	if obj.Usedtreepagecookie != None:
		print("Usedtreepagecookie:" + str(obj.Usedtreepagecookie))
	if obj.WorkfilesCreatedPersec != None:
		print("WorkfilesCreatedPersec:" + str(obj.WorkfilesCreatedPersec))
	if obj.WorktablesCreatedPersec != None:
		print("WorktablesCreatedPersec:" + str(obj.WorktablesCreatedPersec))
	if obj.WorktablesFromCacheRatio != None:
		print("WorktablesFromCacheRatio:" + str(obj.WorktablesFromCacheRatio))
	print("")
	print("########")
	print("")