[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

C# code to monitor CPU

Posted on 2004-03-22
5
Medium Priority
?
2,666 Views
Last Modified: 2007-12-19
i have to develop a C# code to monitor CPU and memory usage of any host in the Internet.Assume there is no security restriction
0
Comment
Question by:Hermoinee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:lorddef
ID: 10649780
I'm sure there is. Unless its a machine you have access to...
0
 
LVL 4

Expert Comment

by:kolpdc
ID: 10650314
i am absolutely sure that you do not have access from your computer to clients spread throughout the network. it should not be allowed. else you could collect all data of all cumputers connected to the internet.

if you are able to put little "satellite"-apps onto each client you want to monitor (for example in intranet), then there should be a possibility.
1.1) every satellite detects the data and writes it into a database (db, file, ...)
1.2.) ... sends collected data to a server containing more intelligence

2.) activeX-control and webbrowser? (microsoft-TECHNICs...;)
0
 
LVL 22

Accepted Solution

by:
cookre earned 2000 total points
ID: 10652924
Both of those requests can be handled by the c# WMI interface.

For available on the local box:
mgmtScope = new ManagementScope("root\\cimv2");
mgmtScope.Connect();
System.Management.ObjectQuery oqr = new System.Management.ObjectQuery("SELECT * FROM Win32_PerfRawData_PerfOS_Memory");
ManagementObjectSearcher query1r = new ManagementObjectSearcher(mgmtScope,oqr);
ManagementObjectCollection queryCollection1r = query1r.Get();            
foreach(ManagementObject mo in queryCollection1r)
       {
       return (UInt64)mo["AvailableBytes"];
       }  

Here's a description of what ManagementScope() looks like for remote boxes:
http://www.csharphelp.com/archives2/archive334.html

For CPU usage, you'll have to sift through these to decide which you want:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfformatteddata_perfos_processor.asp
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question