Computer stats (WEB)

Does anyone have a free webproject that shows computer stats

Like Bandwidth Up and Down in use, ram use, processor use....Uptime...These things...

Thanks !!!!!




Answer this question

Computer stats (WEB)

  • Pete K

    Ok,

    I'll try this...today and then I post if it fits my necessity.

    Thanks



  • Chang Chen

    If you mean local client machine hardly. If you mean server machine where website is hosted you can use performance counters as was already described.

  • Jan Kučera

    some of these can be done using the performance counter.

    Take a look at this thread here, for information on how to get the RAM use/CPU Usage:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=773531&SiteID=1

    in terms of the networking stuff, not entirely sure. One other reference/resource which I believe will help you is this:

    http://msdn2.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx

    It's the performance counter class.

    System uptime can be looked at from the Environment.TickCount, but also using WMI Classes, for checking other uptimes.

    http://msdn2.microsoft.com/en-us/library/system.environment.tickcount.aspx

     


    ManagementScope theScope = new ManagementScope("\\\\" + Environment.MachineName + "\\root\\cimv2");
    StringBuilder theQueryBuilder = new StringBuilder();
    theQueryBuilder.Append(
    "SELECT * FROM Win32_OperatingSystem");
     
    ObjectQuery theQuery = new ObjectQuery(theQueryBuilder.ToString());
    ManagementObjectSearcher theSearcher = new ManagementObjectSearcher(theScope, theQuery);
    ManagementObjectCollection theCollectionOfResults = theSearcher.Get();
     
    foreach (ManagementObject theCurrentObject in theCollectionOfResults)
    {
       string result = theCurrentObject["LastBootUpTime"].ToString();
     
       DateTime theTicks = new DateTime(Convert.ToInt32(result.Substring(8, 6)));
       DateTime t = new DateTime(Convert.ToInt32(result.Substring(0, 4)), Convert.ToInt32(result.Substring(4, 2)), Convert.ToInt32(result.Substring(6, 2)));
       t = t.AddTicks(theTicks.Ticks);
       TimeSpan diff = DateTime.Now - t;
     
       MessageBox.Show(diff.ToString());

    }


     

     

    You may wish to read this in regards to the above code sample, however this is in VBScript but converted to C# using the System.Management.Instrumentation namespace. It talks more about the timing formats:

    http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0907.mspx

    http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0802.mspx



  • Computer stats (WEB)