首页 > Windows开发 > 详细

c# 读取远程主机性能计数器

时间:2015-02-09 15:51:54      阅读:212      评论:0      收藏:0      [点我收藏+]
PerformanceCounter pc = new PerformanceCounter("Web Service", "Current Connections", "Default Web Site","10.1.254.103");

Response.WriteLine(pc.NextValue());
Thread.Sleep(1000);
Response.WriteLine(pc.NextValue());

1.需要using System.Diagnostics;

2.在本地服务器建立一个与远程主机上一样的账号密码即可,远程主机的账号密码需要在Performance Monitor Users和Administrators组下;

(可能需要开启远程主机 Remote Registry 服务)

public PerformanceCounter(
	string categoryName,
	string counterName,
	string instanceName,
	string machineName
)

categoryName
类型:System.String
此性能计数器关联的性能计数器类别(性能对象)的名称。
counterName
类型:System.String
性能计数器的名称。
instanceName
类型:System.String
性能计数器类别实例的名称,或者为空字符串 ("")(如果该类别包含单个实例)。
machineName
类型:System.String
性能计数器及其关联的类别所在的计算机。

 

c# 读取远程主机性能计数器

原文:http://www.cnblogs.com/ssklo/p/4281609.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!