Accessing performance counters on remote machines ...

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

Hello!

I am trying to write some code to access performance counters on a
remote machine. Ideally, I would like to add a machine to a tree
control (like the "Servers" view in the .NET IDE) and prompt the user
to put in a username/password for that machine. I'm not too familiar
with the security model involved here, and was hoping someone either
has come across this before or could point me in the right direction.

Thanks in advance!
Don
 
Don,

You can specify which performance counter you want to attach to on which
machine you want through the constructor. There is an overload which takes
a machine name.

If you want to impersonate another user, then you might want to look at
the Impersonate method on the WindowsIdentity class. The documentation for
that method shows how to use it in conjunction with a call to the LogonUser
API to impersonate another user. You will need to do this if you want to
access performance counters on another machine as another user.

Hope this helps.
 
If you wanna authenticate the user requesting the counters and they have
rights to the counters on the remote network machine, take a look at WMI.
Very easy to implement ... Another alternative is to use the
System.Diagnostics namespace but unless there is a mapped drive (or cached
connection) access will be denied. An additional alternative is publish the
counters to a remoting object and read from there but it is not a very
robust way to handle this problem.

Alex
 
Back
Top