获取从NIC发送和接收的累积字节 [英] Get the cumulative bytes sent and received from a NIC

查看:100
本文介绍了获取从NIC发送和接收的累积字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何简单的方法(也许通过脚本)来获取Windows 2008 Server上的NIC发送和接收的累积字节?

Is there any easy way (via a script perhaps) to get the cumulative bytes sent and received from a NIC on Windows 2008 Server?

例如,NIC当前显示大约18 MB的已发送数据和765 MB的已接收数据.

For example, the NIC currently shows around 18 MB of sent data and 765 MB of received data.

由于我的服务器提供商没有提供一种简单的方法来查看每月的带宽使用情况,因此获取NIC数据似乎是最可靠的方法.

Since my server provider does not provide an easy way to see the monthly bandwidth usage, getting the NIC data seems to be the most reliable one.

我知道我可以使用 PRTG 来通过SNMP获取当前使用情况数据,但只能因为传感器每60秒检查一次,所以平均值.

I know I can use PRTG to get the current usage data via SNMP but it will only be an average since the sensor checks every 60 seconds.

推荐答案

在Powershell(CTP2v3)中,以下命令会有所帮助. (我有三个接口).但是,一旦NIC重新启动,此信息将归零.

In Powershell (CTP2v3), the commands below will help. (I have three interfaces). However, once the NIC was restarted, this information will zero out.

$computer = "LocalHost" ;
$namespace = "root\CIMV2" ;
$Tcpip_NI = Get-WmiObject -class Win32_PerfRawData_Tcpip_NetworkInterface -computername $computer -namespace $namespace ;
$Tcpip_NI | Select BytesReceivedPersec,BytesSentPersec,BytesTotalPersec ;

$netsh_interface_stats = netsh interface ip show interface ;
$netsh_interface_stats | Select-string "In Octets" ;
$netsh_interface_stats | Select-string "Out Octets" ;

这篇关于获取从NIC发送和接收的累积字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆