Contact Info

Crumbtrail

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

Win32_PerfRawData_LDMPerf 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_LDMPerf 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_LDMPerf_LCLDM00LDMMemory')

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.LDM000AllocatedbuffersPersec != None:
		print("LDM000AllocatedbuffersPersec:" + str(obj.LDM000AllocatedbuffersPersec))
	if obj.LDM001FreedbuffersPersec != None:
		print("LDM001FreedbuffersPersec:" + str(obj.LDM001FreedbuffersPersec))
	if obj.LDM002ContentionorspinwaitsPersec != None:
		print("LDM002ContentionorspinwaitsPersec:" + str(obj.LDM002ContentionorspinwaitsPersec))
	if obj.LDM003Bufferviewsallocatedtotal != None:
		print("LDM003Bufferviewsallocatedtotal:" + str(obj.LDM003Bufferviewsallocatedtotal))
	if obj.LDM004Bufferviewsfreeincache != None:
		print("LDM004Bufferviewsfreeincache:" + str(obj.LDM004Bufferviewsfreeincache))
	if obj.LDM005Smallbuffersallocatedtotal != None:
		print("LDM005Smallbuffersallocatedtotal:" + str(obj.LDM005Smallbuffersallocatedtotal))
	if obj.LDM006Smallbuffersfreeincache != None:
		print("LDM006Smallbuffersfreeincache:" + str(obj.LDM006Smallbuffersfreeincache))
	if obj.LDM007Mediumbuffersallocatedtotal != None:
		print("LDM007Mediumbuffersallocatedtotal:" + str(obj.LDM007Mediumbuffersallocatedtotal))
	if obj.LDM008Mediumbuffersfreeincache != None:
		print("LDM008Mediumbuffersfreeincache:" + str(obj.LDM008Mediumbuffersfreeincache))
	if obj.LDM009Largebuffersallocatedtotal != None:
		print("LDM009Largebuffersallocatedtotal:" + str(obj.LDM009Largebuffersallocatedtotal))
	if obj.LDM010Largebuffersfreeincache != None:
		print("LDM010Largebuffersfreeincache:" + str(obj.LDM010Largebuffersfreeincache))
	if obj.LDM011Compositebuffersallocatedtotal != None:
		print("LDM011Compositebuffersallocatedtotal:" + str(obj.LDM011Compositebuffersallocatedtotal))
	if obj.LDM012Compositebuffersfreeincache != None:
		print("LDM012Compositebuffersfreeincache:" + str(obj.LDM012Compositebuffersfreeincache))
	if obj.LDM013Noncacheablebuffersallocations != None:
		print("LDM013Noncacheablebuffersallocations:" + str(obj.LDM013Noncacheablebuffersallocations))
	if obj.LDM014Noncacheablebuffersreleases != None:
		print("LDM014Noncacheablebuffersreleases:" + str(obj.LDM014Noncacheablebuffersreleases))
	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))
	print("")
	print("########")
	print("")