VPS data and bandwidth usage tracking with bandwidthd
You don’t need any database or snmp connection to monitor all of your client with bandwidthd an open source application for monitoring bandwidth usage on Apache and IIS. All you need just libcap, libpng, libgd and apache/IIS installed on your Linux/Windows system and you can monitor all your connected clients per IP and per connection protocol.
Installation and configuration in windows
Download the packages below and install them prior to installing the bandwidthd software
- http://www.winpcap.org/install/bin/WinPcap_4_1_1.exe
- http://downloads.sourceforge.net/project/gnuwin32/libpng/1.2.37/libpng-1.2.37-setup.exe?use_mirror=nchc
- http://www.libgd.org/releases/gd-latest-win32.zip
For installing gd-latest extract the zip archive and place it in a directory in C drive say “gd”. Navigate to the directory C:gdbin and copy the bgd.dll to c:windowssystem32 directory.
- Download the “Bandwidthd” software from the link
http://sourceforge.net/projects/bandwidthd/files/ - Extract the zip archive and place it in a folder say c:inetpubbandwidthd.
- In IIS create a virtual directory either to your existing website or under the default website and point the home directory to “C:Inetpubbandwidthdhtdocs”.
- Open the file C:Inetpubbandwidthdetcbandwidthd.conf and provide the correct subnet of your network.
- Now navigate to the directory C:Inetpubbandwidthd and execute the batch file “Install Service.bat”. This will install a service for bandwidthd. Make the service start up type as automatic and start the service.
- Now point your web server as http://<server IP>/bandwidthd and you will now be able to view the graphs containing the bandwidth statistics.
Installation and configuration in Redhat/Centos/Fedora Linux
- As a prerequisite please ensure that you have libcap, libpng, libgd and apache installed in your computer.
# rpm -qa | grep libcap
# rpm -qa | grep libpng
# rpm -qa | grep gd
# rpm -qa | grep httpd - Next download the bandwidthd RPM according to your Linux distro from the link
http://rpm.pbone.net/index.php3 (Search with “bandwidthd”) - Install the RPM as below
# rpm -ivh bandwidthd-2.0.1-9.el5.i386.rpm
This will install bandwidthd under /var/www/bandwidthd - Next open the httpd.conf file
# vi /etc/httpd/conf/httpd.conf
Add the lines as below to it and save:Alias /bandwidthd “/var/www/bandwidthd/htdocs”
<Directory “/var/www/bandwidthd/htdocs”>
Order Allow,Deny
Allow from All
</Directory> - open /var/www/bandwidthd/etc/bandwidthd.conf and provide the correct subnet for your network.
- Restart the webserver
# service httpd restart. - Start the bandwidthd service
# service bandwidthd start - Now point your browser to http://<server IP>/bandwidthd and start checking the bandwidth statistics graphs.
Few screenshots
Would bandwidthd work behide a iptables firewall?
Yes Joeri, this utility would work fine behind an iptables firewall as iptables would only block incoming connections and bandwidthd is a daemon service withing the server.
open /var/www/bandwidthd/etc/bandwidthd.conf not found
and httpd error “Starting httpd: [Wed Feb 02 07:19:08 2011] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 548 will probably never match because it overlaps an earlier Alias.
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName”
It seems that there are some settings in the httpd.conf that conflicts with your bandwidthd Alias declaration in the the /etc/httpd/conf/httpd.conf. You can provide the configuration here. Also in the /etc/httpd/conf/httpd.conf file provide the correct server FQDN name or IP address against the directive “ServerName”.