Contact Info

Crumbtrail

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

Win32_PerfRawData_PerfOS 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_PerfOS 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_PerfOS_Cache')

for obj in objWMI:
	if obj.AsyncCopyReadsPersec != None:
		print("AsyncCopyReadsPersec:" + str(obj.AsyncCopyReadsPersec))
	if obj.AsyncDataMapsPersec != None:
		print("AsyncDataMapsPersec:" + str(obj.AsyncDataMapsPersec))
	if obj.AsyncFastReadsPersec != None:
		print("AsyncFastReadsPersec:" + str(obj.AsyncFastReadsPersec))
	if obj.AsyncMDLReadsPersec != None:
		print("AsyncMDLReadsPersec:" + str(obj.AsyncMDLReadsPersec))
	if obj.AsyncPinReadsPersec != None:
		print("AsyncPinReadsPersec:" + str(obj.AsyncPinReadsPersec))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CopyReadHitsPercent != None:
		print("CopyReadHitsPercent:" + str(obj.CopyReadHitsPercent))
	if obj.CopyReadHitsPercent_Base != None:
		print("CopyReadHitsPercent_Base:" + str(obj.CopyReadHitsPercent_Base))
	if obj.CopyReadsPersec != None:
		print("CopyReadsPersec:" + str(obj.CopyReadsPersec))
	if obj.DataFlushesPersec != None:
		print("DataFlushesPersec:" + str(obj.DataFlushesPersec))
	if obj.DataFlushPagesPersec != None:
		print("DataFlushPagesPersec:" + str(obj.DataFlushPagesPersec))
	if obj.DataMapHitsPercent != None:
		print("DataMapHitsPercent:" + str(obj.DataMapHitsPercent))
	if obj.DataMapHitsPercent_Base != None:
		print("DataMapHitsPercent_Base:" + str(obj.DataMapHitsPercent_Base))
	if obj.DataMapPinsPersec != None:
		print("DataMapPinsPersec:" + str(obj.DataMapPinsPersec))
	if obj.DataMapPinsPersec_Base != None:
		print("DataMapPinsPersec_Base:" + str(obj.DataMapPinsPersec_Base))
	if obj.DataMapsPersec != None:
		print("DataMapsPersec:" + str(obj.DataMapsPersec))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DirtyPages != None:
		print("DirtyPages:" + str(obj.DirtyPages))
	if obj.DirtyPageThreshold != None:
		print("DirtyPageThreshold:" + str(obj.DirtyPageThreshold))
	if obj.FastReadNotPossiblesPersec != None:
		print("FastReadNotPossiblesPersec:" + str(obj.FastReadNotPossiblesPersec))
	if obj.FastReadResourceMissesPersec != None:
		print("FastReadResourceMissesPersec:" + str(obj.FastReadResourceMissesPersec))
	if obj.FastReadsPersec != None:
		print("FastReadsPersec:" + str(obj.FastReadsPersec))
	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.LazyWriteFlushesPersec != None:
		print("LazyWriteFlushesPersec:" + str(obj.LazyWriteFlushesPersec))
	if obj.LazyWritePagesPersec != None:
		print("LazyWritePagesPersec:" + str(obj.LazyWritePagesPersec))
	if obj.MDLReadHitsPercent != None:
		print("MDLReadHitsPercent:" + str(obj.MDLReadHitsPercent))
	if obj.MDLReadHitsPercent_Base != None:
		print("MDLReadHitsPercent_Base:" + str(obj.MDLReadHitsPercent_Base))
	if obj.MDLReadsPersec != None:
		print("MDLReadsPersec:" + str(obj.MDLReadsPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.PinReadHitsPercent != None:
		print("PinReadHitsPercent:" + str(obj.PinReadHitsPercent))
	if obj.PinReadHitsPercent_Base != None:
		print("PinReadHitsPercent_Base:" + str(obj.PinReadHitsPercent_Base))
	if obj.PinReadsPersec != None:
		print("PinReadsPersec:" + str(obj.PinReadsPersec))
	if obj.ReadAheadsPersec != None:
		print("ReadAheadsPersec:" + str(obj.ReadAheadsPersec))
	if obj.SyncCopyReadsPersec != None:
		print("SyncCopyReadsPersec:" + str(obj.SyncCopyReadsPersec))
	if obj.SyncDataMapsPersec != None:
		print("SyncDataMapsPersec:" + str(obj.SyncDataMapsPersec))
	if obj.SyncFastReadsPersec != None:
		print("SyncFastReadsPersec:" + str(obj.SyncFastReadsPersec))
	if obj.SyncMDLReadsPersec != None:
		print("SyncMDLReadsPersec:" + str(obj.SyncMDLReadsPersec))
	if obj.SyncPinReadsPersec != None:
		print("SyncPinReadsPersec:" + str(obj.SyncPinReadsPersec))
	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("")