Contact Info

Crumbtrail » Administration » Scripts » WMI » python sample

Win32_PerfRawData_DHCPServer 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_DHCPServer 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_DHCPServer_DHCPServer')

for obj in objWMI:
	if obj.AcksPersec != None:
		print("AcksPersec:" + str(obj.AcksPersec))
	if obj.ActiveQueueLength != None:
		print("ActiveQueueLength:" + str(obj.ActiveQueueLength))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.ConflictCheckQueueLength != None:
		print("ConflictCheckQueueLength:" + str(obj.ConflictCheckQueueLength))
	if obj.DeclinesPersec != None:
		print("DeclinesPersec:" + str(obj.DeclinesPersec))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DiscoversPersec != None:
		print("DiscoversPersec:" + str(obj.DiscoversPersec))
	if obj.DuplicatesDroppedPersec != None:
		print("DuplicatesDroppedPersec:" + str(obj.DuplicatesDroppedPersec))
	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.InformsPersec != None:
		print("InformsPersec:" + str(obj.InformsPersec))
	if obj.MillisecondsperpacketAvg != None:
		print("MillisecondsperpacketAvg:" + str(obj.MillisecondsperpacketAvg))
	if obj.NacksPersec != None:
		print("NacksPersec:" + str(obj.NacksPersec))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.OffersPersec != None:
		print("OffersPersec:" + str(obj.OffersPersec))
	if obj.PacketsExpiredPersec != None:
		print("PacketsExpiredPersec:" + str(obj.PacketsExpiredPersec))
	if obj.PacketsReceivedPersec != None:
		print("PacketsReceivedPersec:" + str(obj.PacketsReceivedPersec))
	if obj.ReleasesPersec != None:
		print("ReleasesPersec:" + str(obj.ReleasesPersec))
	if obj.RequestsPersec != None:
		print("RequestsPersec:" + str(obj.RequestsPersec))
	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))