Protected Sub GetPerfMonMetrics(ByVal Hostname As String) 'This process will connect to a remote host and read/collect the relevant PerfMon Data. 'Disk utilization for all local drives. 'Overall CPU Utilization 'Memory usage for each messagse broker 'Values for the threadq's. ' MsgBox("Executing Sub-routine GetPerfMonMetrics for " & Hostname) Dim perf_processor As New PerformanceCounter("Processor", "% Processor Time") Dim perf_logdisk As New PerformanceCounter("LogicalDisk", "% Free Space") Dim perf_process As New PerformanceCounter("Process", "Working Set", "MSAccess") Try With perf_processor .MachineName = Hostname .CategoryName = "Processor" .CounterName = "% Processor Time" .InstanceName = "_Total" End With Catch MsgBox("Error reading the % Processor Time counter.") End Try Try With perf_logdisk .CategoryName = "LogicalDisk" .CounterName = "% Free Space" .InstanceName = "C:" End With Catch MsgBox("Error reading the Logical Disk, %Free Space counter.") End Try Try With perf_process .CategoryName = "Process" .CounterName = "Working Set" End With Catch MsgBox("Error reading the % Process Working Set counter.") End Try System.Threading.Thread.Sleep(1000) MsgBox("CPU usage = " & perf_processor.NextValue()) MsgBox("Access memory used/working set = " & perf_process.NextValue()) MsgBox("Logical Disk " & perf_logdisk.NextValue()) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)