Contact Info

Crumbtrail

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

Win32_PerfRawData_WSIPPerf perl 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

use Win32::OLE('in');

my $computer = ".";

my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_PerfRawData_WSIPPerf_LCSIP00Networking", "WQL");

foreach my $objItem (in $colItems) {
	print "Caption: $objItem->{Caption}\n";
	print "Description: $objItem->{Description}\n";
	print "Frequency_Object: $objItem->{Frequency_Object}\n";
	print "Frequency_PerfTime: $objItem->{Frequency_PerfTime}\n";
	print "Frequency_Sys100NS: $objItem->{Frequency_Sys100NS}\n";
	print "Name: $objItem->{Name}\n";
	print "SIP000Sockets: $objItem->{SIP000Sockets}\n";
	print "SIP001SocketsPersec: $objItem->{SIP001SocketsPersec}\n";
	print "SIP002ConnectionsEstablished: $objItem->{SIP002ConnectionsEstablished}\n";
	print "SIP003ConnectionsEstablishedPersec: $objItem->{SIP003ConnectionsEstablishedPersec}\n";
	print "SIP004ConnectionsFailedToEstablish: $objItem->{SIP004ConnectionsFailedToEstablish}\n";
	print "SIP005ConnectionsFailedToEstablishPerSec: $objItem->{SIP005ConnectionsFailedToEstablishPerSec}\n";
	print "SIP006ConnectionsRefusedDueToServerOverload: $objItem->{SIP006ConnectionsRefusedDueToServerOverload}\n";
	print "SIP007ConnectionsRefusedDueToServerOverloadPerSec: $objItem->{SIP007ConnectionsRefusedDueToServerOverloadPerSec}\n";
	print "SIP008ConnectionsBeingEstablished: $objItem->{SIP008ConnectionsBeingEstablished}\n";
	print "SIP009TLSNegotiationCompleted: $objItem->{SIP009TLSNegotiationCompleted}\n";
	print "SIP010TLSNegotiationsCompletedPersec: $objItem->{SIP010TLSNegotiationsCompletedPersec}\n";
	print "SIP011TLSNegotiationsFailed: $objItem->{SIP011TLSNegotiationsFailed}\n";
	print "SIP012TLSNegotiationsFailedPersec: $objItem->{SIP012TLSNegotiationsFailedPersec}\n";
	print "SIP013TLSConnectionsBeingNegotiated: $objItem->{SIP013TLSConnectionsBeingNegotiated}\n";
	print "SIP014Uniqueusersconnecteddirectly: $objItem->{SIP014Uniqueusersconnecteddirectly}\n";
	print "SIP015Connectionsaboveperuserlimitdropped: $objItem->{SIP015Connectionsaboveperuserlimitdropped}\n";
	print "SIP016ConnectionsaboveperuserlimitdroppedPersec: $objItem->{SIP016ConnectionsaboveperuserlimitdroppedPersec}\n";
	print "SIP017OutstandingAcceptOperations: $objItem->{SIP017OutstandingAcceptOperations}\n";
	print "SIP018OutstandingReceiveOperations: $objItem->{SIP018OutstandingReceiveOperations}\n";
	print "SIP019DNSqueriesresolvedviatheoperatingsystem: $objItem->{SIP019DNSqueriesresolvedviatheoperatingsystem}\n";
	print "SIP020DNSqueriesqueuedforDNSresolution: $objItem->{SIP020DNSqueriesqueuedforDNSresolution}\n";
	print "SIP021DNSqueriesbeingresolvedbytheoperatingsystem: $objItem->{SIP021DNSqueriesbeingresolvedbytheoperatingsystem}\n";
	print "SIP022SuccessfulDNSqueries: $objItem->{SIP022SuccessfulDNSqueries}\n";
	print "SIP023FailedDNSqueries: $objItem->{SIP023FailedDNSqueries}\n";
	print "SIP024TimedoutDNSqueries: $objItem->{SIP024TimedoutDNSqueries}\n";
	print "SIP025SuccessfulaccessestotheinternalDNScache: $objItem->{SIP025SuccessfulaccessestotheinternalDNScache}\n";
	print "SIP026SuccessfulaccessestotheinternalDNScachepersecond: $objItem->{SIP026SuccessfulaccessestotheinternalDNScachepersecond}\n";
	print "SIP027SuccessfulDNSqueryresultsintheinternalDNScache: $objItem->{SIP027SuccessfulDNSqueryresultsintheinternalDNScache}\n";
	print "SIP028FailedDNSqueryresultsintheinternalDNScache: $objItem->{SIP028FailedDNSqueryresultsintheinternalDNScache}\n";
	print "SIP029LastDNSquerytime: $objItem->{SIP029LastDNSquerytime}\n";
	print "SIP030Numberoftimesnegativecacheentrieswereaccessed: $objItem->{SIP030Numberoftimesnegativecacheentrieswereaccessed}\n";
	print "SIP031TimespentinmillisecondsdoingDNSqueries: $objItem->{SIP031TimespentinmillisecondsdoingDNSqueries}\n";
	print "Timestamp_Object: $objItem->{Timestamp_Object}\n";
	print "Timestamp_PerfTime: $objItem->{Timestamp_PerfTime}\n";
	print "Timestamp_Sys100NS: $objItem->{Timestamp_Sys100NS}\n";
	print "\n";
	print "########\n";
	print "\n";
}