Performance Monitor

Hello All,

I am developing a monitor application for our servers. Ideally this will have a minimum impact on the servers themselves (i could run from a workstation) and would monitor network connectivity, available memory and processor load as a function of number of cleints connected.

I wouold like to use something like:

PerformanceCounterCategory[] RegisteredCategories =
PerformanceCounterCategory.GetCategories();

in an ASP.NET/ C# application, it works locally but I am not sure if it can be done remotely getting the "performanceCounterCategories" from a couple of windows server 2003 boxes, or even if this is the right way to do it. This information would be sent in our intranet only (a test environment) so I am not too worried about security,

The alternative (if the former is just too difficult or a bad idea) would be make web services running on the servers and make my application get the info from there, but I am not sure if that would impact the performance too much (like measure the performance while running the web service would be significatly different from measunring without)

Any suggestions/input as to how can I ge the Performance Counters remotely would be appreciated.

L A



Answer this question

Performance Monitor

  • RNettles

    Greg,

    The article information is just what I needed. Thank you very much!


  • Jeff The Super Man

    Hi LA,

    Thanks for contacting with Microsoft. According to your previous question, here're some links of introduction to performance counters and samples.

    An Introduction To Performance Counters

    http://www.codeproject.com/dotnet/perfcounter.asp

    Monitoring Distributed Service Performance in .NET

    http://www.codeproject.com/csharp/MonitorServicePerformance.asp

    We sincerely hope this can be of help. If anything is unclear, please don't hesitate to get in touch. Any comments and further feedback from you will be welcome and highly valued.

    Cheers,

    Cleo



  • Johan Nordin

    Thanks for the reply.

    I checked the link and stil have been able to use the static method

    PerformanceCounterCategory.GetCategories("MACIHNE_NAME");

    it throws:

    System.ComponentModel.Win32Exception was unhandled by user code
    Message="Access is denied"
    Source="System"
    ErrorCode=-2147467259
    NativeErrorCode=5
    StackTrace:
    at System.Diagnostics.PerformanceMonitor.Init()
    at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
    at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
    at System.Diagnostics.PerformanceCounterLib.GetCategories(String machineName)
    at System.Diagnostics.PerformanceCounterCategory.GetCategories(String machineName)
    at Default2.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\PerfMon\Default.aspx.cs:line 25
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Do I have to setup special permisions/account for perfmon or something like that on the remote boxes


  • rutu

    Yes you do.

    http://support.microsoft.com/default.aspx scid=kb;en-us;q317012 this article details the privileges needed on the remote machine (or you can just use an admin/power user account which already have the privs)


  • John Taylor

    Using it with remote machines is a fine idea, it was developed for just this. http://msdn2.microsoft.com/en-us/library/system.diagnostics.performancecountercategory(VS.80).aspx includes some examples using remote machines.
  • Performance Monitor