Difference between revisions of "Tutorials and How-tos/Install vnStat"
Dmitri Popov (talk | contribs) |
m (Updated to latest version of vnstat php frontend) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<br>'''''If, like a lot of people, you want to keep track of your bandwidth usage, then this might help you. Just working on configuring the vnstat php frontend at the''''' | Author: asparak<br>'''''If, like a lot of people, you want to keep track of your bandwidth usage, then this might help you. Just working on configuring the vnstat php frontend at the''''' | ||
'''''moment and its pretty easy. I have wget installed, but you can install that easily if you don't have it''''' | '''''moment and its pretty easy. I have wget installed, but you can install that easily if you don't have it''''' | ||
Line 5: | Line 5: | ||
apt-get install wget | apt-get install wget | ||
1. Firstly install vnstat | 1. Firstly install vnstat | ||
apt-get install vnstat | apt-get install vnstat | ||
2. Download and put the vnstat frontend on your webserver. The filenames are for example, check their website for the latest version obviously :) | 2. Download and put the vnstat frontend on your webserver. The filenames are for example, check their website for the latest version obviously :) | ||
cd /home/web | cd /home/web | ||
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1. | wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz | ||
tar xvfz vnstat_php_frontend-1. | tar xvfz vnstat_php_frontend-1.5.1.tar.gz | ||
3. The next steps aren't essential, but I do it anyway, just for neatness | 3. The next steps aren't essential, but I do it anyway, just for neatness | ||
mv vnstat_php_frontend-1. | mv vnstat_php_frontend-1.5.1 vnstat | ||
chown -R www-data:users vnstat | chown -R www-data:users vnstat | ||
4. Run vnstat to set up your databases for the interface(s) you want to monitor | 4. Run vnstat to set up your databases for the interface(s) you want to monitor | ||
vnstat -u -i eth0 | vnstat -u -i eth0 | ||
Line 27: | Line 27: | ||
then it starts to record your data. After a few minutes, you might want to run vnstat from the command line, just to make sure its recording data properly. Leave it a few minutes, or it won't have had chance to gather anything. | then it starts to record your data. After a few minutes, you might want to run vnstat from the command line, just to make sure its recording data properly. Leave it a few minutes, or it won't have had chance to gather anything. | ||
5. cd into the vnstat frontend directory | 5. cd into the vnstat frontend directory | ||
6. edit the config.php file to set your interfaces the right way round and add /usr/bin/vnstat to the $vnstat_bin protocol and you should be good to go | 6. edit the config.php file to set your interfaces the right way round and add /usr/bin/vnstat to the $vnstat_bin protocol and you should be good to go |
Latest revision as of 11:41, 20 October 2010
Author: asparak
If, like a lot of people, you want to keep track of your bandwidth usage, then this might help you. Just working on configuring the vnstat php frontend at the
moment and its pretty easy. I have wget installed, but you can install that easily if you don't have it
apt-get install wget
1. Firstly install vnstat
apt-get install vnstat
2. Download and put the vnstat frontend on your webserver. The filenames are for example, check their website for the latest version obviously :)
cd /home/web wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz tar xvfz vnstat_php_frontend-1.5.1.tar.gz
3. The next steps aren't essential, but I do it anyway, just for neatness
mv vnstat_php_frontend-1.5.1 vnstat chown -R www-data:users vnstat
4. Run vnstat to set up your databases for the interface(s) you want to monitor
vnstat -u -i eth0 vnstat -u -i eth1
then it starts to record your data. After a few minutes, you might want to run vnstat from the command line, just to make sure its recording data properly. Leave it a few minutes, or it won't have had chance to gather anything.
5. cd into the vnstat frontend directory
6. edit the config.php file to set your interfaces the right way round and add /usr/bin/vnstat to the $vnstat_bin protocol and you should be good to go
7. Now you may want to download and install the daemon script from the vnstat homepage if you want to run vnstat on reboot, or you can just start it manually. http://humdi.net/vnstat/init.d/debian/vnstat You can use update-rc.d to set it up as well. This is the debian equivalent of chkconfig
cd /etc/init.d wget http://humdi.net/vnstat/init.d/debian/vnstat chmod a+x vnstat update-rc.d -f vnstat defaults
8. Up to you if you want to password control the directory using .htaccess file. I do