This is article is based on a RHEL/CentOS box.
BandwidthD is a tiny 200Kb bandwidth monitoring service. So if you only need bandwidth statistics this is a really great choice.
To get bandwidthD with the yum package manager you need to install the EPEL repo (this is for RHEL 6):
$ curl -O http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm $ rpm -Uvh epel-release-6-8.noarch.rpm
If using RHEL 5 or 7, go and find the other repositories here:
$ yum install bandwidthd
This should be enough to install bandwidthd when EPEL is available.
Now you will have to choose what subnets you want to be monitored. Default is local IP addresses 10.0.0.0, 192.168.0.0, etc. I like to be specific, so lets say we have a range called 10.200.10.0/24, i would go with that specifically. You can write it both with /24 if it is a /24-range, or with the netmask 255.255.255.0. You will also have to tell bandwidthd what device you want monitored, in this case a bonded interface called bond0. Most times this would be eth0 or eth1. Check with
Open /etc/bandwidthd.conf with you prefered editor. In my case vim (
$ vim /etc/bandwidthd.conf):
... # Subnets to collect statistics on. Traffic that # matches none of these subnets will be ignored. # Syntax is either IP Subnet Mask or CIDR subnet 10.200.10.0/24 # subnet 10.200.10.0 255.255.255.0 # Device to listen on # Bandwidthd listens on the first device it detects # by default. Run "bandwidthd -l" for a list of # devices. dev "bond0" ...
Enable cdf to save the monitored bandwidth data (this is set to false by default):
... #Log data to cdf file htdocs/log.cdf output_cdf true #Read back the cdf file on startup recover_cdf true ...
Symlink http data
On RHEL you will find that bandwidthd has placed the http data in /var/www/bandwidthd. Symlink this path to the path of your document root, if it is located somewhere else, like /var/www/html. Then i would do:
$ ln -s /var/www/bandwidthd /var/www/html/bandwidthd
Ready to browse
Now you should be ready to start bandwidthd:
$ /etc/init.d/bandwidthd start
Browse your URL with bandwidthd connected to it. After a few minutes you should see a simple interface with statistics like this:
Have fun.comments powered by Disqus