Contact Info

Crumbtrail

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

Win32_PerfRawData_MSSQLServerOLAPService 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_MSSQLServerOLAPService 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_MSSQLServerOLAPService_MSAS2008Cache')

for obj in objWMI:
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Currententries != None:
		print("Currententries:" + str(obj.Currententries))
	if obj.CurrentKB != None:
		print("CurrentKB:" + str(obj.CurrentKB))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.Directhitratio != None:
		print("Directhitratio:" + str(obj.Directhitratio))
	if obj.Directhitratio_Base != None:
		print("Directhitratio_Base:" + str(obj.Directhitratio_Base))
	if obj.DirecthitsPersec != None:
		print("DirecthitsPersec:" + str(obj.DirecthitsPersec))
	if obj.EvictionsPersec != None:
		print("EvictionsPersec:" + str(obj.EvictionsPersec))
	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.InsertsPersec != None:
		print("InsertsPersec:" + str(obj.InsertsPersec))
	if obj.KBaddedPersec != None:
		print("KBaddedPersec:" + str(obj.KBaddedPersec))
	if obj.LookupsPersec != None:
		print("LookupsPersec:" + str(obj.LookupsPersec))
	if obj.MissesPersec != None:
		print("MissesPersec:" + str(obj.MissesPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	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.Totaldirecthits != None:
		print("Totaldirecthits:" + str(obj.Totaldirecthits))
	if obj.Totalevictions != None:
		print("Totalevictions:" + str(obj.Totalevictions))
	if obj.Totalfilterediteratorcachehits != None:
		print("Totalfilterediteratorcachehits:" + str(obj.Totalfilterediteratorcachehits))
	if obj.Totalfilterediteratorcachemisses != None:
		print("Totalfilterediteratorcachemisses:" + str(obj.Totalfilterediteratorcachemisses))
	if obj.Totalinserts != None:
		print("Totalinserts:" + str(obj.Totalinserts))
	if obj.Totallookups != None:
		print("Totallookups:" + str(obj.Totallookups))
	if obj.Totalmisses != None:
		print("Totalmisses:" + str(obj.Totalmisses))
	print("")
	print("########")
	print("")