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

From BubbaWiki
Jump to navigation Jump to search
(Created page with '= vnstat and vnstat frontend - mini howto = <br>'''''If, like a lot of people, you want to keep track of your bandwidth usage, then this might help you. Just working on configu...')
 
m (Updated to latest version of vnstat php frontend)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= vnstat and vnstat frontend - mini howto  =
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'''''  
 
<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'''''  


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


1. Firstly install vnstat  
1. Firstly install vnstat  


<br> apt-get install vnstat  
apt-get install vnstat  
 
<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>


<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
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.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  
3. The next steps aren't essential, but I do it anyway, just for neatness  


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


<br>
4. Run vnstat to set up your databases for the interface(s) you want to monitor


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


<br> vnstat -u -i eth0<br> 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.


<br>
5. cd into the vnstat frontend directory


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


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>

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