New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

vnstat and vnstat frontend - mini howto

A collection of tips on howto tweak your Bubba.
Post Reply
asparak
Posts: 173
Joined: 08 Jun 2009, 07:38

vnstat and vnstat frontend - mini howto

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

Code: Select all

apt-get install wget
1. Firstly install vnstat

Code: Select all

apt-get install vnstat
2. Download and put the vnstat frontend on your webserver.

Code: Select all

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

Code: Select all

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

Code: Select all

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

Code: Select all

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
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: vnstat and vnstat frontend - mini howto

Post by Cheeseboy »

Nice.
Thanks!
pcrene
Posts: 305
Joined: 17 May 2008, 15:49

Re: vnstat and vnstat frontend - mini howto

Post by pcrene »

Hello

I installed vnstat and frontend a while ago. As i did not use the WAN port
the info i saw was correct: eth1 produces trafic and eth0 gave an error.
Since last week i use eth0/WAN with static IP but the next day no trafic data is shown.

I did: vnstat -u -i eth0 again what not solved the problem..

Notice: Undefined index: totalrx in /home/web/vnstat/index.php on line 81
Notice: Undefined index: totalrxk in /home/web/vnstat/index.php on line 81
Notice: Undefined index: totaltx in /home/web/vnstat/index.php on line 82
Notice: Undefined index: totaltxk in /home/web/vnstat/index.php on line 82

How can i solve this problem?

Rene
B3 1T + B-Stor 2T, B2 1T as backup
40 users active....
Opensat4all.Com
pcrene
Posts: 305
Joined: 17 May 2008, 15:49

Re: vnstat and vnstat frontend - mini howto

Post by pcrene »

Hello All

Found that eth0 is "disabled" .. what to do:

Server8:/etc/init.d# vnstat -D -u -i eth0
arg 1: "-D"
arg 2: "-u"
Updating database...
arg 3: "-i"
Used interface: eth0
bzise 4096
blocks 2405462
bfree 1918090
bavail 1795896
ffree 1182498
7183584 free space left
Database loaded for interface "eth0"...
Disabled interface "eth0" not updated.
B3 1T + B-Stor 2T, B2 1T as backup
40 users active....
Opensat4all.Com
pcrene
Posts: 305
Joined: 17 May 2008, 15:49

Re: vnstat and vnstat frontend - mini howto

Post by pcrene »

Hello All,

vnstat -u -enable -i eth0

did the job....

Rene
B3 1T + B-Stor 2T, B2 1T as backup
40 users active....
Opensat4all.Com
neilkpd
Posts: 3
Joined: 30 Nov 2010, 12:17

Re: vnstat and vnstat frontend - mini howto

Post by neilkpd »

I need help installing on Vyatta router http://www.vyatta.org, which already have Lighttpd installed for its frontend.

Vnstat is installed and working great but I don't want anyone having access to the Vyatta router.

I have already installed vnstat-frontend requirements, Apache2, PHP5, PHP5-GD without any problem. My problem arises from setting up vnstat-frontend on Apache2.

I would appreciate a step-by-step please.


Thank you
Neil
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: vnstat and vnstat frontend - mini howto

Post by Cheeseboy »

Hi Neil,

I think you need to supply more details.
Are you trying to set this up on a bubba or some other hardware?
If it is a bubba, then which one?

If you have the vnstat web page working on your bubba2 or b3 and want to protect it from access from outside your network you can add something like this to your /etc/apache2/apache2.conf file:

Code: Select all

<Directory "/home/web/vnstat">
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 192.168.10.0/24
        Allow from 127.0.0.1
</Directory>
Best regards,

Cheeseboy
neilkpd
Posts: 3
Joined: 30 Nov 2010, 12:17

Re: vnstat and vnstat frontend - mini howto

Post by neilkpd »

I thought I did.

Vyatta is an open source network operating system based on Debian Lenny. It is in fact a manageable software router that comes with its own Lighttpd frontend.

Bubba is an operating system similarly built based on Debian.

My problem is, I need to setup the vnstat-frontend on Apache2 while still accessing the Vyatta router frontend via Lighttpd.

Thank you for helping.
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: vnstat and vnstat frontend - mini howto

Post by Cheeseboy »

I thought I did.
You did not.
Vyatta is an open source network operating system based on Debian Lenny. It is in fact a manageable software router that comes with its own Lighttpd frontend.
OK, where have you installed this piece of software? On the bubba?
Bubba is an operating system similarly built based on Debian.
Well, one could also say it is a piece of hardware. There are three different versions of that hardware, and they all come with different software, so which one is it?
My problem is, I need to setup the vnstat-frontend on Apache2 while still accessing the Vyatta router frontend via Lighttpd.
Sounds easy enough, just make the two HTTP servers listen on different port numbers.
neilkpd
Posts: 3
Joined: 30 Nov 2010, 12:17

Re: vnstat and vnstat frontend - mini howto

Post by neilkpd »

Why did you introduce Bubba?

There isn't a Bubba, only a Vyatta router on which I would like to also install vnstat frontend.

Can you help me with this,
Sounds easy enough, just make the two HTTP servers listen on different port numbers.
thank you
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: vnstat and vnstat frontend - mini howto

Post by Cheeseboy »

Why did you introduce Bubba?
Eeh, because this is a bubba forum?
Can you help me with this,
Sorry, no. I don't know anything about it.
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: vnstat and vnstat frontend - mini howto

Post by DanielM »

Cheeseboy wrote:
Why did you introduce Bubba?
Eeh, because this is a bubba forum?
ROTFL! Why on the earth would you start talking about Bubba here! :D

No. Honestly. I think this board needs more moderators. I'll post a thread about that somewhere else...

/Daniel
Post Reply