Activities

August 2011
M T W T F S S
« Jul   Sep »
1234567
891011121314
15161718192021
22232425262728
293031  

Bandwidthd : Collecting traffic statistics

An add-on to Pfesence, I’m taking this out to install on my squid transparent router for collecting cumulative bandwidth report.

BandwidthD tracks usage of TCP/IP network subnets and builds html files with graphs to display utilization and will be one of the good traffic visual analyzer like Cacti does which collect the statistics data from SNMP port.

How do I install

Bandwidthd requires the following package support
1.libpcap
2. libpng
3. libgd
4. bison
5. flex these all are get free from the GNU library.

After installing the said above packages, download the core package from sourceforge,
download url : http://sourceforge.net/projects/bandwidthd/files/bandwidthd/
#tar -zxvf bandwidthd-2.0.1.tgz && ./configure && make && make install

This install copy the binary files under “/usr/local/bandwidthd” and then create a symbolic link of it to system path
[root@rc-009 bandwidthd]# ln -s /usr/local/bandwidthd/bandwidthd /usr/bin/bandwidthd

Edit the config file and set the network source to collect the data

[root@rc-009 bandwidthd]# vi /usr/local/bandwidthd/etc/bandwidthd.conf <code>

Add or modify the values respect to your network, some values are shown below

<code>[root@rc-009 bandwidthd]# cat /usr/local/bandwidthd/etc/bandwidthd.conf | sed '/ *#/d; /^ *$/d'
subnet 192.168.0.0/26
dev "eth0"  # my router  private IP

Start Bandwidthd

 [root@rc-009 bandwidthd]# bandwidthd &
[1] 15270
[root@rc-009 bandwidthd]# ps -aux | grep "bandwidthd"
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root     15272  0.0  0.0   5312   688 pts/0    S    14:05   0:00 bandwidthd
root     15273  0.0  0.0   5312   676 pts/0    S    14:05   0:00 bandwidthd
root     15274  0.0  0.0   5312   676 pts/0    S    14:05   0:00 bandwidthd
root     15275  0.0  0.0   5312   676 pts/0    S    14:05   0:00 bandwidthd
root     15277  0.0  0.0   3916   668 pts/0    S+   14:05   0:00 grep bandwidthd
[1]+  Done                    bandwidthd
[root@rc-009 bandwidthd]#

Now you need to configure Apache to serve the static html file. Open the config file and added a Alias entry in it.

[root@rc-009 bandwidthd]# vi /etc/httpd/conf/httpd.conf

Alias /bandwidthd /usr/local/bandwidthd/htdocs/

Now you can access the graph over the browser like http://squidserver ip/bandwidthd

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>