Difference between revisions of "Tutorials and How-tos/Install vnStat"

From BubbaWiki
Jump to navigation Jump to search
m (Tidy up of code sections and remove secondary title)
(tidy up a bit)
Line 3: Line 3:
'''''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'''''  


<br> apt-get install wget  
apt-get install wget  


<br>
1. Firstly install vnstat


1. Firstly install vnstat  
apt-get install vnstat  


<br> 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&nbsp;:)


<br>2. Download and put the vnstat frontend on your webserver. The filenames are for example, check their website for the latest version obviously&nbsp;:)<br>
cd /home/web
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
tar xvfz vnstat_php_frontend-1.4.1.tar.gz


<br> cd /home/web<br> wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz<br> tar xvfz vnstat_php_frontend-1.4.1.tar.gz
3. The next steps aren't essential, but I do it anyway, just for neatness


<br>
mv vnstat_php_frontend-1.4.1 vnstat
chown -R www-data:users vnstat


3. The next steps aren't essential, but I do it anyway, just for neatness
4. Run vnstat to set up your databases for the interface(s) you want to monitor


<br> mv vnstat_php_frontend-1.4.1 vnstat<br> chown -R www-data:users vnstat
vnstat -u -i eth0
vnstat -u -i eth1


<br>
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.
 
<br>4. Run vnstat to set up your databases for the interface(s) you want to monitor
 
<br> vnstat -u -i eth0<br> vnstat -u -i eth1
 
<br>


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<br>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  


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  
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  


<br> cd /etc/init.d<br> wget http://humdi.net/vnstat/init.d/debian/vnstat<br> chmod a+x vnstat<br> update-rc.d -f vnstat defaults  
cd /etc/init.d
 
wget http://humdi.net/vnstat/init.d/debian/vnstat
<br>
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<br><br>
8. Up to you if you want to password control the directory using .htaccess file. I do<br><br>

Revision as of 09:18, 20 April 2010


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.4.1.tar.gz
tar xvfz vnstat_php_frontend-1.4.1.tar.gz 

3. The next steps aren't essential, but I do it anyway, just for neatness

mv vnstat_php_frontend-1.4.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