使用 WMI 监控远程计算机上的带宽
我正在尝试监控远程 Windows 计算机上的接口带宽。到目前为止,我将 SNMP 与思科带宽公式结合使用但这需要在两个不同时间检索两个样本。最后但并非最不重要的一点是,我用 SNMP 记录的值似乎是完全错误的。由于我有 WMI 支持,我想使用它,但我发现的唯一值(这似乎是我正在寻找的)是 Win32_PerfRawData_Tcpip_NetworkInterface。然而,该值看起来更像是一个总计数器(就像 SNMP 一样)。有没有办法通过WMI检索即时当前带宽?为了澄清当前带宽字段始终返回 1000000000(这是最大带宽),正如您可以想象的那样,它没有帮助。
I am trying to monitor interfaces bandwidth on a remote Windows machine. So far I used SNMP with the Cisco Bandwidth Formula but that requires to retrieve two samples at two different times. Last but not least it seems that the value I record with SNMP is quite wrong. Since I have WMI support I'd like to use it but the only value I've found (which seems to be what I'm looking for) is BytesTotalPerSec of the Win32_PerfRawData_Tcpip_NetworkInterface. That value however looks more like a total counter (just like the SNMP one). Is there a way to retrieve the instant current bandwidth through WMI? To clarify the Current Bandwidth field always return 1000000000 (which is the Maximum Bandwidth) and as you can imagine it is not helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
性能计数器数据暴露在 2 个位置:Win32_PerfRawData* 和 Win32_PerfFormattedData*。前者包含原始数据,后者包含派生统计数据,这就是您所追求的。
例如,您通常在 perfmon 中看到的是 Win32_PerfFormattedData* 数据。
试试这个:
根据经验,在给定的秒内进行测量是毫无用处的,除非您每秒都收集指标。
如果您想要分钟带宽,您可以通过获取 2 个样本,从原始数据中自行得出它(无论如何您都必须在 Windows 2000 上执行此操作)。
如果这更有意义,请参阅此处的 Windows 2000 部分。
Windows 2000 上的派生统计信息
这里有一篇很棒的文章 制作您自己的格式化性能数据提供程序
如果您想深入研究在较长采样间隔内收集更多统计信息
John
Performance counter data is exposed in 2 places, Win32_PerfRawData* and Win32_PerfFormattedData*. The former contains raw data, the latter contains derived statistics, and is what you're after.
What you typically see in perfmon (for example) is the Win32_PerfFormattedData* data.
Try this :
From experience, taking a measurement for a given second is pretty useless unless you're collecting the metric every second.
If you wanted the minutely bandwidth, you could derive it yourself from the raw data by taking 2 samples (you have to do this on Windows 2000 anyway)
See the windows 2000 section here if that makes more sense.
Derived stats on Windows 2000
There's an excellent article here Make your own Formatted Performance Data Provider
If you wanted to delve into collecting more statistical information over a longer sampling interval
John