Contact Info

Crumbtrail

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

Win32_PerfFormattedData_NETDataProviderforSqlServer 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_NETDataProviderforSqlServer 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_NETDataProviderforSqlServer_NETDataProviderforSqlServer')

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.HardConnectsPerSecond != None:
		print("HardConnectsPerSecond:" + str(obj.HardConnectsPerSecond))
	if obj.HardDisconnectsPerSecond != None:
		print("HardDisconnectsPerSecond:" + str(obj.HardDisconnectsPerSecond))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.NumberOfActiveConnectionPoolGroups != None:
		print("NumberOfActiveConnectionPoolGroups:" + str(obj.NumberOfActiveConnectionPoolGroups))
	if obj.NumberOfActiveConnectionPools != None:
		print("NumberOfActiveConnectionPools:" + str(obj.NumberOfActiveConnectionPools))
	if obj.NumberOfActiveConnections != None:
		print("NumberOfActiveConnections:" + str(obj.NumberOfActiveConnections))
	if obj.NumberOfFreeConnections != None:
		print("NumberOfFreeConnections:" + str(obj.NumberOfFreeConnections))
	if obj.NumberOfInactiveConnectionPoolGroups != None:
		print("NumberOfInactiveConnectionPoolGroups:" + str(obj.NumberOfInactiveConnectionPoolGroups))
	if obj.NumberOfInactiveConnectionPools != None:
		print("NumberOfInactiveConnectionPools:" + str(obj.NumberOfInactiveConnectionPools))
	if obj.NumberOfNonPooledConnections != None:
		print("NumberOfNonPooledConnections:" + str(obj.NumberOfNonPooledConnections))
	if obj.NumberOfPooledConnections != None:
		print("NumberOfPooledConnections:" + str(obj.NumberOfPooledConnections))
	if obj.NumberOfReclaimedConnections != None:
		print("NumberOfReclaimedConnections:" + str(obj.NumberOfReclaimedConnections))
	if obj.NumberOfStasisConnections != None:
		print("NumberOfStasisConnections:" + str(obj.NumberOfStasisConnections))
	if obj.SoftConnectsPerSecond != None:
		print("SoftConnectsPerSecond:" + str(obj.SoftConnectsPerSecond))
	if obj.SoftDisconnectsPerSecond != None:
		print("SoftDisconnectsPerSecond:" + str(obj.SoftDisconnectsPerSecond))
	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))
	print("")
	print("########")
	print("")