.NET Open Source Softwares

Open source softwares written in VB .NET and C#

Computer Performance Monitoring Tool

Computer Monitoring Tool can track resource performance of multiple machine across the network. It displays CPU percentage, Memory Available and Disk Usage. This is perfect for system administrators who want to be alerted on probable system downtime. Aside from resources utilization, it also alert stakeholders if a server/machine is offline. It Uses WMI Classes to get the data from another computer. This tool is just a major revision of an existing performance monitoring I found at Codeproject.com (sorry forgot the page. credit to the author). It adapted the WMI coding style from that project, added a database and included a lot more features.

AUTHOR
foxtrot0911

PLATFORM
Framework: Microsoft .NET Framework 2.0
IDE: Visual Studio 2005

BEST PRACTICE FOR
Windows Management Instrumentation

SAMPLE SCREENSHOTS

Computer Monitoring Tool

Computer Monitoring Tool

Machines maintenance

Machines maintenance

Stakeholders Maintenance

Stakeholders Maintenance

Processes Tab

Processes Tab

SAMPLE CODES/TECHNIQUES
Here’s how to connect to remote computer’s WMI database

if (Dns.GetHostName() == strHostName)
{
mgmtScope = new ManagementScope(“\\\\” + strHostName+ “\\root\\cimv2″);
}
else
{
options = new ConnectionOptions();
options.Username = strUserName;
options.Password = strPassword;

// scope object for remote machine
mgmtScope = new ManagementScope(“\\\\” + strHostName + “\\root\\cimv2″,options);

}

// connect to machine to monitor. Return 0 if not able to connect
try
{
mgmtScope.Connect();
}
catch (System.UnauthorizedAccessException)
{
return 0;
}
catch (System.Runtime.InteropServices.COMException)
{
return 0;
}
catch
{
return 0;
}

To get the CPU utilization, call the WMI query “Win32_PerfRawData_PerfOS_Processor”

// CPU %
mPath_CPU = new ManagementPath();
mPath_CPU.RelativePath = “Win32_PerfRawData_PerfOS_Processor.Name=’0′”;
mObject_CPU = new ManagementObject(mgmtScope,mPath_CPU,null);

To retrieve available memory, use “Win32_PerfRawData_PerfOS_Memory”

mPath_Mem = new ManagementPath();
mPath_Mem.RelativePath = “Win32_PerfRawData_PerfOS_Memory”;
mc = new ManagementClass(mgmtScope,mPath_Mem,null);

DOWNLOAD URL
You can download the setup package from here
From Mediafire/Setup executable
Full source code here
From Mediafire/Source Code

Filed under: C# , , , ,

Leave a Reply