Archive for June, 2007

Linux Quiz #008

Friday, June 15th, 2007

Bandwidth Monitor (Submit Answer)

Create a script in the language of your choice to monitor transmit and receive bandwidth in bytes per second. The script should accept two arguments, the interface to monitor and the interval it is checked (in seconds). Output should be in CSV format to STDOUT with the following fields: Timestamp,Interface,RX Bytes/sec,TX Bytes/sec.

Example output:

wriley@behemoth:~$ BWMon --interface eth0 --interval 2
Timestamp,Interface,RX Bytes/Sec,TX Bytes/Sec
2007-05-16 09:10:16,eth0,2043,0
2007-05-16 09:10:18,eth0,1963,0
2007-05-16 09:10:20,eth0,1518,0
2007-05-16 09:10:22,eth0,2304,0
2007-05-16 09:10:24,eth0,1326,0