Posts

Showing posts from August, 2010

Monitoring network bandwidth usage

Image
During the development of my monitoring tool, I've faced a little challenge - find a crossplatform (Linux/FreeBSD) way to monitor network bandwidth usage. Surprisingly, there is no simple way to do it. In this post I'll reveal my research and the solution I've found and implemented. Linux One of the ways to do it is using ifconfig output: $ ifconfig eth0 eth0      Link encap:Ethernet  HWaddr 00:23:54:15:54:96           inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::223:54ff:fe15:5496/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:23242 errors:0 dropped:0 overruns:0 frame:0           TX packets:22369 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:24061454 (24.0 MB)  TX bytes:3265008 (3.2 MB)           Interrupt:30 Base address:0xe000 We can ask for RX (received) and TX (transmitted) bytes each second, and the differ