phpBandwidth |
phpBandwidth is a bandwidth monitoring tool for those that share a internet connection through a linux box with iptables and are so
unlucky that they have a download limit. phpBandwidth uses iptables and a database to log traffic. If you want to see how it looks, you can see it on the online demo, that's Even better than screenshots But here is a screenshot anyway Screen Shoot 1 |
The tarball |
phpbandwidth.tar.gz |
Installation: |
1. Download the tarball and unpack the tar file to some dir on your web server. 2. Edit the db_config.php file, to fit your database and tastes 3. Create the database, Do 'createdb bandwidth' 4. Point your browser to wherever you placed the files, and to db_install.php. Follow the instructions there.. 5. After you have created the users on the web page, you must fill in the routes manualy in the database. I will try to get this fixed... 6. You need to setup sudo to let the web server user run iptables. Add this to /etc/sudoers: apache ALL=(root) NOPASSWD: /sbin/iptables The test version only supports a postgresql database. But it should be easy to port to other databases, so mysql and others will be supported in the future. (if anyone ports it, please mail me) 7. Set up a cron job to run the accounting script I use: */5 * * * * root php /home/httpd/htdocs/phpbandwidth/acounting.php If you don't have the php console client, you can use lynx -dump localhost/accounting.php Any problems or suggestions contact me here |
To-Do: |
Todo before release: * add route selection per user web interface * cleanup the db_'db type'.php files so porting will be easier * check for gd lib in install script * code cleanup and adding comments * should cleenup the bw_image.php code, but it works.... Features for later releases: If you can think of other cool features that's not listed, please send me a mail * Mailing users or an administrator when they pass a defined threshold * A posibility to automaticly turn off access to users that has past a limit * A posibility for users to turn off and on ther access to the net * DONE 2003-03-27 (rewrite html_bar() to use to bar pictures one red or yellow. if prosent > 100, then scale down and user the other color for the extra prosentage) |
News / Changelog: |
News: 2003-04-05 * Uploaded new tarball, lots of improvements, have a look. Check out the live one at alex.wigen.net/phpbandwidth/ * New accounting.php, only one cron job. 2003-03-24 * Image generator now supports in and out bandwidth(blue/green) and text scale and time of day. Two image formates depending the size of the requested picture 2003-03-23 * Added traffic image generation! This requires the gd libs compiled into php * Added ip based security. In db_config.php, to stop anyone to add,del users * Fixed the logging threshold * Seriuos cleanup of db_posgresql.php. Ready for porting... * "Configure Users" option hidden if user is not in trusted_ip list 2003-03-22 Ok, now it's starting to look like something. * phpbandwidth now features an install-script. Call db_install.php from your web-browser. That will create the tables for you. * You can now add users from the web interface, and adjust the download limit for each users. * A route manager is emerging, currently it only displays the routes that are alocated to the current user. More work on that soon. * You can now see the downloads for each day! |