Wednesday, 9 September 2009

Monitoring Bandwidth Usage - iftop

iftop does for network usage what top(1) does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.

Overview of IFTOP
* iftop (interface top) derives the name from the standard unix top command. top command displays real-time CPU Usage. iftop command displays real-time network bandwidth usage.

* iftop displays the network usage of a specific interface on the host.

* Using iftop you can identify which host is responsible for slowing down your network.

* To find out which process is causing the problem, note down the port number from the iftop and use netstat -p to identify the process.

* iftop monitors your network activity, and displays a table of current bandwidth.

Installation:
OpenSuSe user can use "1-click" installer to install iftop
OpenSuSe 11.1 - here
OpenSuSe 11.0 - here

Others:
Download the source code form the iftop website - here and compile/install iftop using following commands
# tar -zxvf iftop-0.17.tar.gz
# cd iftop-0.17
# ./configure
# make
# make install

Using:
Go to your cosole and use command: iftop to start monitoring the bandwidth usage.
you can also specify a particular interface with the -i option: iftop -i eth1, some other options ..
* -p Enables promiscuous mode, so the traffic on any interface (if there is more than once) is checked and counted

* -P Shows also the port that connection is using both on both side

* -N Do not resolve port names, which is the default behavior when you enable the -P option, so it will shows you :www or :80


Troubleshooting iftop Issues

Issue 1: While installing iftop from source, executing ./configure gives the following pcap.ph error message.

[root@localhost iftop-0.17]# ./configure

checking gethostbyaddr_r usability... yes

checking where to find pcap.h... no idea

configure: error: can't find pcap.h

You're not going to get very far without libpcap.

Solution 1: Make sure libpcap and libpcap-devel is installed. If not, install it as shown below.

# up2date -i libpcap libpcap-devel

Installing...

1:libpcap          ######################### [100%]

2:libpcap-devel  ######################### [100%]

# rpm -qa | grep libpcap

libpcap-devel-0.9.4-12.el5.0.1

libpcap-0.9.4-12.el5.0.1

Issue 2: While installing iftop from source, executing ./configure gives the following ncurses/mvchgat error message.

[root@localhost iftop-0.17]# ./configure

checking for a curses library containing mvchgat... none found

configure: error: Curses! Foiled again!

(Can't find a curses library supporting mvchgat.)

Consider installing ncurses.

Solution 2: Make sure ncurses and ncurses-devel is installed. If not, install it as shown below.

# up2date -i ncurses ncurses-devel

Installing...

1:ncurses          ######################### [100%]

1:ncurses-devel  ######################### [100%]

# rpm -qa | grep ncurses

ncurses-devel-5.5-24.20060715

ncurses-5.5-24.20060715

** Troubleshooting iftop Issues

Issue 1: While installing iftop from source, executing ./configure gives the following pcap.ph error message.

[root@localhost iftop-0.17]# ./configure

checking gethostbyaddr_r usability... yes

checking where to find pcap.h... no idea

configure: error: can't find pcap.h

You're not going to get very far without libpcap.

Solution 1: Make sure libpcap and libpcap-devel is installed. If not, install it as shown below.

# up2date -i libpcap libpcap-devel

Installing...

1:libpcap          ######################### [100%]

2:libpcap-devel  ######################### [100%]

# rpm -qa | grep libpcap

libpcap-devel-0.9.4-12.el5.0.1

libpcap-0.9.4-12.el5.0.1

Issue 2: While installing iftop from source, executing ./configure gives the following ncurses/mvchgat error message.

[root@localhost iftop-0.17]# ./configure

checking for a curses library containing mvchgat... none found

configure: error: Curses! Foiled again!

(Can't find a curses library supporting mvchgat.)

Consider installing ncurses.

Solution 2: Make sure ncurses and ncurses-devel is installed. If not, install it as shown below.

# up2date -i ncurses ncurses-devel

Installing...

1:ncurses          ######################### [100%]

1:ncurses-devel  ######################### [100%]

# rpm -qa | grep ncurses

ncurses-devel-5.5-24.20060715

ncurses-5.5-24.20060715

No comments:

Post a Comment