Vnstat2 with pfsense 2.1 snapshots?

  • LAYER 8 Global Moderator

    So it seems to be working, after you create the /var/db location, etc.

    But the frontend is broke

    ) is deprecated in /usr/local/www/vnstat2/vnstat.php on line 130 Deprecated: Function split() is deprecated in /usr/local/www/vnstat2/vnstat.php on line 130 Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/vnstat2/vnstat.php:130) in /usr/local/www/vnstat2/index.php on line 146

    Notice: Undefined index: totalrx in /usr/local/www/vnstat2/index.php on line 77 Notice: Undefined index: totalrxk in /usr/local/www/vnstat2/index.php on line 77 Notice: Undefined index: totaltx in /usr/local/www/vnstat2/index.php on line 78 Notice: Undefined index: totaltxk in /usr/local/www/vnstat2/index.php on line 78

  • LAYER 8 Global Moderator

    someone have clue to how to get vnstat working on the current 2.1 snaps

    I replaced split with explode – got rid of 130 error.. But not sure if right?

    Not reading data from what I can tell -- where exactly are the --dumpdb suppose to be stored?  Is that function how it works?

    Be nice if owner of this package would fix it up for us using 2.1 snaps, does it even work on 2.0 line?

  • it does work with 2.0x releases, just not 2.1. 2.1 is using a different version of PHP. I think its 5.3, while 2.0x is using 5.2.. I'm not sure if vnstat-frontend ( is ready for 5.3.

  • @johnpoz:

    So it seems to be working, after you create the /var/db location, etc.

    Can you elaborate on how to got it to work? I can't get mine to work at all. I replaced split with explode and got rid of that particular error, but it's still not getting any data. I can live without the php front-end, but I'd at least like the data I used to have under 2.0.

  • LAYER 8 Global Moderator

    you have to create the /var/db/vnstat directory

  • Not going crazy with this write up as I don't really have the time.. This is a quick way to get you up and running with vnstat2 on 2.1 with 1.5.1 frontend.. I offer no support for this.

    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/	2012-07-11 11:51:22.000000000 -0400
    +++ /root/custom/misc_files/	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

    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

    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 4-8 may 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.

  • LAYER 8 Global Moderator

    So I followed these instructions - grabbing the patches package was good suggestion ;)  Worked Great!

    So attached is couple of screens showing it working - THANKS!

  • sweet! i'm going to copy my post and start a new topic shortly… wanted to make sure it worked  ;) before giving it out to the masses.

    ps  Click on the pfSense GUI link... brings you back into the web interface

Log in to reply