Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Vnstat + PHP frontend

Joined
Jun 9, 2016
Messages
5
Hello, i'm new to freenas and bsd but i love it already.
I don't know if this is possible but i want to run vnstat + phpfrontend in the root install. Has this been done before ? any guides ?

if i create a jail for this could i still monitor other jails nics (i'm pretty sure not and thus the reason to install in root install.)

This is the guide to vnstat. can this be done from the install shell ?

Step #1: Update Ports Tree

You must update port tree by typing the following portsnap command:
# portsnap fetch update

Step #2: Install vnStat
Type the following command to find out exact port location:
# cd /usr/ports
# whereis vnstat


Install the vnstat, run:
# cd /usr/ports/net/vnsta
# make install clean
# rehash

Alternatively, you can install the binary package using the pkg_add command, enter:
# pkg_add -r -v vnstat

Step #3: Configure vnStat
Now, vnstat has been installed. However, you need to configure /usr/local/etc/vnstat.conf file, enter:
# cp /usr/local/etc/vnstat.conf.sample /usr/local/etc/vnstat.conf
# vi /usr/local/etc/vnstat.conf

Set default interface

Interface "re0"
Set maximum bandwidth (Mbit) for all interfaces, use 0 to disable feature. In this example, set to 100Mbit:

MaxBandwidth 100
Save and close the file.

Step #3.1: Set vnStat cron job
You need to collect network stats using a cron job, enter:
# crontab -e
Append the following cronjob enter:

# run vnstat update every 5 minutes if installed
*/5 * * * * if [ -x /usr/local/bin/vnstat ] && [ `ls -l /var/db/vnstat/ | wc -l` -ge 1 ]; then /usr/local/bin/vnstat -u; fi
Save and close the file. Finally, create directory, enter:
# mkdir /var/db/vnstat

Step #3.2: Create Interface Specific Stats
Type the following command:

vnstat -u -i interfaceName
In this example, set em0 and em1, enter:
# vnstat -u -i em0
# vnstat -u -i em1

PHP frontend: https://github.com/bjd/vnstat-php-frontend



Can this be embedded in the gui of freenas somehow ?
 
Joined
Jun 9, 2016
Messages
5
Ok, setup vm with freenas to play around, the manual does not work. will post back when i got it working or when i'm hitting a brick wall :)
 

Fredde

Newbie
Joined
Dec 7, 2015
Messages
58
Is there any change to get this to work with other jails? i have several jails i want to monitor, maybe this is the way?
 
Top