Contact Info

Crumbtrail

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

Win32_PerfRawData_PerfNet 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_PerfNet 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_PerfNet_Browser')

for obj in objWMI:
	if obj.AnnouncementsDomainPersec != None:
		print("AnnouncementsDomainPersec:" + str(obj.AnnouncementsDomainPersec))
	if obj.AnnouncementsServerPersec != None:
		print("AnnouncementsServerPersec:" + str(obj.AnnouncementsServerPersec))
	if obj.AnnouncementsTotalPersec != None:
		print("AnnouncementsTotalPersec:" + str(obj.AnnouncementsTotalPersec))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DuplicateMasterAnnouncements != None:
		print("DuplicateMasterAnnouncements:" + str(obj.DuplicateMasterAnnouncements))
	if obj.ElectionPacketsPersec != None:
		print("ElectionPacketsPersec:" + str(obj.ElectionPacketsPersec))
	if obj.EnumerationsDomainPersec != None:
		print("EnumerationsDomainPersec:" + str(obj.EnumerationsDomainPersec))
	if obj.EnumerationsOtherPersec != None:
		print("EnumerationsOtherPersec:" + str(obj.EnumerationsOtherPersec))
	if obj.EnumerationsServerPersec != None:
		print("EnumerationsServerPersec:" + str(obj.EnumerationsServerPersec))
	if obj.EnumerationsTotalPersec != None:
		print("EnumerationsTotalPersec:" + str(obj.EnumerationsTotalPersec))
	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.IllegalDatagramsPersec != None:
		print("IllegalDatagramsPersec:" + str(obj.IllegalDatagramsPersec))
	if obj.MailslotAllocationsFailed != None:
		print("MailslotAllocationsFailed:" + str(obj.MailslotAllocationsFailed))
	if obj.MailslotOpensFailedPersec != None:
		print("MailslotOpensFailedPersec:" + str(obj.MailslotOpensFailedPersec))
	if obj.MailslotReceivesFailed != None:
		print("MailslotReceivesFailed:" + str(obj.MailslotReceivesFailed))
	if obj.MailslotWritesFailed != None:
		print("MailslotWritesFailed:" + str(obj.MailslotWritesFailed))
	if obj.MailslotWritesPersec != None:
		print("MailslotWritesPersec:" + str(obj.MailslotWritesPersec))
	if obj.MissedMailslotDatagrams != None:
		print("MissedMailslotDatagrams:" + str(obj.MissedMailslotDatagrams))
	if obj.MissedServerAnnouncements != None:
		print("MissedServerAnnouncements:" + str(obj.MissedServerAnnouncements))
	if obj.MissedServerListRequests != None:
		print("MissedServerListRequests:" + str(obj.MissedServerListRequests))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.ServerAnnounceAllocationsFailedPersec != None:
		print("ServerAnnounceAllocationsFailedPersec:" + str(obj.ServerAnnounceAllocationsFailedPersec))
	if obj.ServerListRequestsPersec != None:
		print("ServerListRequestsPersec:" + str(obj.ServerListRequestsPersec))
	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("")