How-to install vnstat2 on 2.1 with 1.5.1 web frontend



  • Since vnstat2 isn't working correctly on 2.1 and I was able to get it to work on my setup; I figured I would share :-)

    This is a quick way to get you up and running with vnstat2 on 2.1 with 1.5.1 frontend.. I offer little to no support for this. It has been confirmed that it does work by forum user johnpoz http://forum.pfsense.org/index.php/topic,47241.msg274527.html#msg274527

    1: Install vnstat2 package

    2: Since moving to PBI, vnstat is looking for its conf file at /usr/pbi/vnstat-i386/etc. Because of this this, the database isn't created correctly (/conf/vnstat) to match what is coded thru out the package. To fix this, enter the below in shell

    
    ln -s /usr/local/etc/vnstat.conf /usr/pbi/vnstat-i386/etc/vnstat.conf
    
    

    3: Re-install package GUI XML components only (This will now create the DB files for your interfaces using the correct paths based on /usr/local/etc/vnstat.conf

    4: Add this patch (search if your not sure how to add a patch. Add the system patches package; makes it easy)

    
    --- /usr/local/pkg/vnstat2.inc	2012-07-11 11:51:22.000000000 -0400
    +++ /root/custom/misc_files/vnstat2.inc	2012-07-11 12:12:29.000000000 -0400
    @@ -224,6 +224,8 @@
     	}
             $iface_title_array = implode($iface_title_array_items2);
     	// php in php static items
    +        $locale = "\$locale";
    +        $language = "\$language";
             $vnstat_bin2 = "\$vnstat_bin = '/usr/local/bin/vnstat';";
             $data_dir2 = "\$data_dir = './dumps';";
             $graph_format2 ="\$graph_format='svg';";
    @@ -261,6 +263,8 @@
         //
         // edit these to reflect your particular situation
         //
    +$locale = 'en_US.UTF-8';
    +$language = 'en';
    
         // list of network interfaces monitored by vnStat
     $iface_list_array
    
    

    5: Goto Status:vnstat2, check the checkbox to enable the vnstat web frontend then click Save

    6: Delete everything within folder /usr/local/www/vnstat2 EXECPT for config.php

    7: Download this zip file and extract it to /usr/local/www/vnstat2
    https://dl.dropbox.com/u/11597356/pfSense/vnstat2.zip

    8: That should do it.. Goto Status:vnstat2 then the tab for the front end… Enjoy!!

    known issues::
    1: When you reboot, for some reason its not creating the /usr/local/www/vnstat2/config.php file correctly.. Easy fix tho, go to Status:vnstat2 and just click on the Save icon.. This will recreate /usr/local/www/vnstat2/config.php file...

    PS If you do a system firmware upgrade steps 2, 4-8 will need to be completed again..but the database and the linked config will stay so it will collect data while your preforming the steps for the web frontend.


  • Rebel Alliance Global Moderator

    So I just upgraded to current snap after getting this working before - thanks for the easy instructions and updated files!

    2.1-BETA0 (i386)
    built on Thu Jul 12 22:33:31 EDT 2012
    FreeBSD 8.3-RELEASE-p3

    After the update to get it working again - as you state hit apply in system patches, replaced the files with the ones in vnstat2.zip all there is too it.

    Now if we can just get this put into the actual package that would be perfect.



  • @johnpoz:

    Now if we can just get this put into the actual package that would be perfect.

    i'm with you there…


Locked