当前位置: 技术问答>linux和unix
怎样统计主机的通信流量?
来源: 互联网 发布时间:2016-09-11
本文导语: 如题:我老师让我些一个程序在Planlab统计主机通信流量的程序,采集一些数据!可以那上面的机器都是Linux系统,可以使用Python脚本进行交互!各位大人可有什么什么思路... 小弟跪求.... | http://linux.v...
如题:我老师让我些一个程序在Planlab统计主机通信流量的程序,采集一些数据!可以那上面的机器都是Linux系统,可以使用Python脚本进行交互!各位大人可有什么什么思路...
小弟跪求....
|
|
分析 ifconfig 的结果应该就可以吧。
eth0 Link encap:Ethernet HWaddr 00:23:54:99:8C:8C
inet addr:192.168.168.116 Bcast:192.168.168.255 Mask:255.255.255.0
inet6 addr: fe80::223:54ff:fe99:8c8c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12506 errors:0 dropped:0 overruns:0 frame:0
TX packets:6169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5804941 (5.5 MiB) TX bytes:1487984 (1.4 MiB)
Interrupt:220 Base address:0xa000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5120 errors:0 dropped:0 overruns:0 frame:0
TX packets:5120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4133014 (3.9 MiB) TX bytes:4133014 (3.9 MiB)
eth0 Link encap:Ethernet HWaddr 00:23:54:99:8C:8C
inet addr:192.168.168.116 Bcast:192.168.168.255 Mask:255.255.255.0
inet6 addr: fe80::223:54ff:fe99:8c8c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12506 errors:0 dropped:0 overruns:0 frame:0
TX packets:6169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5804941 (5.5 MiB) TX bytes:1487984 (1.4 MiB)
Interrupt:220 Base address:0xa000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5120 errors:0 dropped:0 overruns:0 frame:0
TX packets:5120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4133014 (3.9 MiB) TX bytes:4133014 (3.9 MiB)