Contact Info

Crumbtrail

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

Win32_PerfRawData_WSIPPerf 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_WSIPPerf 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_WSIPPerf_LCSIP00Networking')

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.Name != None:
		print("Name:" + str(obj.Name))
	if obj.SIP000Sockets != None:
		print("SIP000Sockets:" + str(obj.SIP000Sockets))
	if obj.SIP001SocketsPersec != None:
		print("SIP001SocketsPersec:" + str(obj.SIP001SocketsPersec))
	if obj.SIP002ConnectionsEstablished != None:
		print("SIP002ConnectionsEstablished:" + str(obj.SIP002ConnectionsEstablished))
	if obj.SIP003ConnectionsEstablishedPersec != None:
		print("SIP003ConnectionsEstablishedPersec:" + str(obj.SIP003ConnectionsEstablishedPersec))
	if obj.SIP004ConnectionsFailedToEstablish != None:
		print("SIP004ConnectionsFailedToEstablish:" + str(obj.SIP004ConnectionsFailedToEstablish))
	if obj.SIP005ConnectionsFailedToEstablishPerSec != None:
		print("SIP005ConnectionsFailedToEstablishPerSec:" + str(obj.SIP005ConnectionsFailedToEstablishPerSec))
	if obj.SIP006ConnectionsRefusedDueToServerOverload != None:
		print("SIP006ConnectionsRefusedDueToServerOverload:" + str(obj.SIP006ConnectionsRefusedDueToServerOverload))
	if obj.SIP007ConnectionsRefusedDueToServerOverloadPerSec != None:
		print("SIP007ConnectionsRefusedDueToServerOverloadPerSec:" + str(obj.SIP007ConnectionsRefusedDueToServerOverloadPerSec))
	if obj.SIP008ConnectionsBeingEstablished != None:
		print("SIP008ConnectionsBeingEstablished:" + str(obj.SIP008ConnectionsBeingEstablished))
	if obj.SIP009TLSNegotiationCompleted != None:
		print("SIP009TLSNegotiationCompleted:" + str(obj.SIP009TLSNegotiationCompleted))
	if obj.SIP010TLSNegotiationsCompletedPersec != None:
		print("SIP010TLSNegotiationsCompletedPersec:" + str(obj.SIP010TLSNegotiationsCompletedPersec))
	if obj.SIP011TLSNegotiationsFailed != None:
		print("SIP011TLSNegotiationsFailed:" + str(obj.SIP011TLSNegotiationsFailed))
	if obj.SIP012TLSNegotiationsFailedPersec != None:
		print("SIP012TLSNegotiationsFailedPersec:" + str(obj.SIP012TLSNegotiationsFailedPersec))
	if obj.SIP013TLSConnectionsBeingNegotiated != None:
		print("SIP013TLSConnectionsBeingNegotiated:" + str(obj.SIP013TLSConnectionsBeingNegotiated))
	if obj.SIP014Uniqueusersconnecteddirectly != None:
		print("SIP014Uniqueusersconnecteddirectly:" + str(obj.SIP014Uniqueusersconnecteddirectly))
	if obj.SIP015Connectionsaboveperuserlimitdropped != None:
		print("SIP015Connectionsaboveperuserlimitdropped:" + str(obj.SIP015Connectionsaboveperuserlimitdropped))
	if obj.SIP016ConnectionsaboveperuserlimitdroppedPersec != None:
		print("SIP016ConnectionsaboveperuserlimitdroppedPersec:" + str(obj.SIP016ConnectionsaboveperuserlimitdroppedPersec))
	if obj.SIP017OutstandingAcceptOperations != None:
		print("SIP017OutstandingAcceptOperations:" + str(obj.SIP017OutstandingAcceptOperations))
	if obj.SIP018OutstandingReceiveOperations != None:
		print("SIP018OutstandingReceiveOperations:" + str(obj.SIP018OutstandingReceiveOperations))
	if obj.SIP019DNSqueriesresolvedviatheoperatingsystem != None:
		print("SIP019DNSqueriesresolvedviatheoperatingsystem:" + str(obj.SIP019DNSqueriesresolvedviatheoperatingsystem))
	if obj.SIP020DNSqueriesqueuedforDNSresolution != None:
		print("SIP020DNSqueriesqueuedforDNSresolution:" + str(obj.SIP020DNSqueriesqueuedforDNSresolution))
	if obj.SIP021DNSqueriesbeingresolvedbytheoperatingsystem != None:
		print("SIP021DNSqueriesbeingresolvedbytheoperatingsystem:" + str(obj.SIP021DNSqueriesbeingresolvedbytheoperatingsystem))
	if obj.SIP022SuccessfulDNSqueries != None:
		print("SIP022SuccessfulDNSqueries:" + str(obj.SIP022SuccessfulDNSqueries))
	if obj.SIP023FailedDNSqueries != None:
		print("SIP023FailedDNSqueries:" + str(obj.SIP023FailedDNSqueries))
	if obj.SIP024TimedoutDNSqueries != None:
		print("SIP024TimedoutDNSqueries:" + str(obj.SIP024TimedoutDNSqueries))
	if obj.SIP025SuccessfulaccessestotheinternalDNScache != None:
		print("SIP025SuccessfulaccessestotheinternalDNScache:" + str(obj.SIP025SuccessfulaccessestotheinternalDNScache))
	if obj.SIP026SuccessfulaccessestotheinternalDNScachepersecond != None:
		print("SIP026SuccessfulaccessestotheinternalDNScachepersecond:" + str(obj.SIP026SuccessfulaccessestotheinternalDNScachepersecond))
	if obj.SIP027SuccessfulDNSqueryresultsintheinternalDNScache != None:
		print("SIP027SuccessfulDNSqueryresultsintheinternalDNScache:" + str(obj.SIP027SuccessfulDNSqueryresultsintheinternalDNScache))
	if obj.SIP028FailedDNSqueryresultsintheinternalDNScache != None:
		print("SIP028FailedDNSqueryresultsintheinternalDNScache:" + str(obj.SIP028FailedDNSqueryresultsintheinternalDNScache))
	if obj.SIP029LastDNSquerytime != None:
		print("SIP029LastDNSquerytime:" + str(obj.SIP029LastDNSquerytime))
	if obj.SIP030Numberoftimesnegativecacheentrieswereaccessed != None:
		print("SIP030Numberoftimesnegativecacheentrieswereaccessed:" + str(obj.SIP030Numberoftimesnegativecacheentrieswereaccessed))
	if obj.SIP031TimespentinmillisecondsdoingDNSqueries != None:
		print("SIP031TimespentinmillisecondsdoingDNSqueries:" + str(obj.SIP031TimespentinmillisecondsdoingDNSqueries))
	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("")