Contact Info

Crumbtrail

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

Win32_PerfRawData_ESENT 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_ESENT 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_ESENT_Database", "WQL");

foreach my $objItem (in $colItems) {
	print "Caption: $objItem->{Caption}\n";
	print "DatabaseCacheMemoryCommitted: $objItem->{DatabaseCacheMemoryCommitted}\n";
	print "DatabaseCacheMemoryCommittedMB: $objItem->{DatabaseCacheMemoryCommittedMB}\n";
	print "DatabaseCacheMemoryReserved: $objItem->{DatabaseCacheMemoryReserved}\n";
	print "DatabaseCacheMemoryReservedMB: $objItem->{DatabaseCacheMemoryReservedMB}\n";
	print "DatabaseCacheMissesPersec: $objItem->{DatabaseCacheMissesPersec}\n";
	print "DatabaseCachePercentDehydrated: $objItem->{DatabaseCachePercentDehydrated}\n";
	print "DatabaseCachePercentDehydrated_Base: $objItem->{DatabaseCachePercentDehydrated_Base}\n";
	print "DatabaseCachePercentHit: $objItem->{DatabaseCachePercentHit}\n";
	print "DatabaseCachePercentHit_Base: $objItem->{DatabaseCachePercentHit_Base}\n";
	print "DatabaseCachePercentHitUncorrelated: $objItem->{DatabaseCachePercentHitUncorrelated}\n";
	print "DatabaseCachePercentHitUncorrelated_Base: $objItem->{DatabaseCachePercentHitUncorrelated_Base}\n";
	print "DatabaseCacheRequestsPersec: $objItem->{DatabaseCacheRequestsPersec}\n";
	print "DatabaseCacheSize: $objItem->{DatabaseCacheSize}\n";
	print "DatabaseCacheSizeEffective: $objItem->{DatabaseCacheSizeEffective}\n";
	print "DatabaseCacheSizeEffectiveMB: $objItem->{DatabaseCacheSizeEffectiveMB}\n";
	print "DatabaseCacheSizeMB: $objItem->{DatabaseCacheSizeMB}\n";
	print "DatabaseCacheSizeResident: $objItem->{DatabaseCacheSizeResident}\n";
	print "DatabaseCacheSizeResidentMB: $objItem->{DatabaseCacheSizeResidentMB}\n";
	print "DatabaseMaintenanceDuration: $objItem->{DatabaseMaintenanceDuration}\n";
	print "DatabaseMaintenancePagesBadChecksums: $objItem->{DatabaseMaintenancePagesBadChecksums}\n";
	print "DatabasePageEvictionsPersec: $objItem->{DatabasePageEvictionsPersec}\n";
	print "DatabasePageFaultsPersec: $objItem->{DatabasePageFaultsPersec}\n";
	print "DatabasePageFaultStallsPersec: $objItem->{DatabasePageFaultStallsPersec}\n";
	print "DefragmentationTasks: $objItem->{DefragmentationTasks}\n";
	print "DefragmentationTasksPending: $objItem->{DefragmentationTasksPending}\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 "IODatabaseReadsAttachedAverageLatency: $objItem->{IODatabaseReadsAttachedAverageLatency}\n";
	print "IODatabaseReadsAttachedAverageLatency_Base: $objItem->{IODatabaseReadsAttachedAverageLatency_Base}\n";
	print "IODatabaseReadsAttachedPersec: $objItem->{IODatabaseReadsAttachedPersec}\n";
	print "IODatabaseReadsAverageLatency: $objItem->{IODatabaseReadsAverageLatency}\n";
	print "IODatabaseReadsAverageLatency_Base: $objItem->{IODatabaseReadsAverageLatency_Base}\n";
	print "IODatabaseReadsPersec: $objItem->{IODatabaseReadsPersec}\n";
	print "IODatabaseReadsRecoveryAverageLatency: $objItem->{IODatabaseReadsRecoveryAverageLatency}\n";
	print "IODatabaseReadsRecoveryAverageLatency_Base: $objItem->{IODatabaseReadsRecoveryAverageLatency_Base}\n";
	print "IODatabaseReadsRecoveryPersec: $objItem->{IODatabaseReadsRecoveryPersec}\n";
	print "IODatabaseWritesAttachedAverageLatency: $objItem->{IODatabaseWritesAttachedAverageLatency}\n";
	print "IODatabaseWritesAttachedAverageLatency_Base: $objItem->{IODatabaseWritesAttachedAverageLatency_Base}\n";
	print "IODatabaseWritesAttachedPersec: $objItem->{IODatabaseWritesAttachedPersec}\n";
	print "IODatabaseWritesAverageLatency: $objItem->{IODatabaseWritesAverageLatency}\n";
	print "IODatabaseWritesAverageLatency_Base: $objItem->{IODatabaseWritesAverageLatency_Base}\n";
	print "IODatabaseWritesPersec: $objItem->{IODatabaseWritesPersec}\n";
	print "IODatabaseWritesRecoveryAverageLatency: $objItem->{IODatabaseWritesRecoveryAverageLatency}\n";
	print "IODatabaseWritesRecoveryAverageLatency_Base: $objItem->{IODatabaseWritesRecoveryAverageLatency_Base}\n";
	print "IODatabaseWritesRecoveryPersec: $objItem->{IODatabaseWritesRecoveryPersec}\n";
	print "IOLogReadsAverageLatency: $objItem->{IOLogReadsAverageLatency}\n";
	print "IOLogReadsAverageLatency_Base: $objItem->{IOLogReadsAverageLatency_Base}\n";
	print "IOLogReadsPersec: $objItem->{IOLogReadsPersec}\n";
	print "IOLogWritesAverageLatency: $objItem->{IOLogWritesAverageLatency}\n";
	print "IOLogWritesAverageLatency_Base: $objItem->{IOLogWritesAverageLatency_Base}\n";
	print "IOLogWritesPersec: $objItem->{IOLogWritesPersec}\n";
	print "LogBytesGeneratedPersec: $objItem->{LogBytesGeneratedPersec}\n";
	print "LogBytesWritePersec: $objItem->{LogBytesWritePersec}\n";
	print "LogRecordStallsPersec: $objItem->{LogRecordStallsPersec}\n";
	print "LogThreadsWaiting: $objItem->{LogThreadsWaiting}\n";
	print "LogWritesPersec: $objItem->{LogWritesPersec}\n";
	print "Name: $objItem->{Name}\n";
	print "SessionsInUse: $objItem->{SessionsInUse}\n";
	print "SessionsPercentUsed: $objItem->{SessionsPercentUsed}\n";
	print "SessionsPercentUsed_Base: $objItem->{SessionsPercentUsed_Base}\n";
	print "TableClosesPersec: $objItem->{TableClosesPersec}\n";
	print "TableOpenCacheHitsPersec: $objItem->{TableOpenCacheHitsPersec}\n";
	print "TableOpenCacheMissesPersec: $objItem->{TableOpenCacheMissesPersec}\n";
	print "TableOpenCachePercentHit: $objItem->{TableOpenCachePercentHit}\n";
	print "TableOpenCachePercentHit_Base: $objItem->{TableOpenCachePercentHit_Base}\n";
	print "TableOpensPersec: $objItem->{TableOpensPersec}\n";
	print "TablesOpen: $objItem->{TablesOpen}\n";
	print "Timestamp_Object: $objItem->{Timestamp_Object}\n";
	print "Timestamp_PerfTime: $objItem->{Timestamp_PerfTime}\n";
	print "Timestamp_Sys100NS: $objItem->{Timestamp_Sys100NS}\n";
	print "VersionBucketsAllocated: $objItem->{VersionBucketsAllocated}\n";
	print "\n";
	print "########\n";
	print "\n";
}