Hirdetés

Új hozzászólás Aktív témák

  • norbszt

    tag

    válasz lehella #1104 üzenetére

    Én így csináltam:
    Nálam a web root: nas/www

    ipkg install vnstat

    vi /opt/etc/vnstat.conf

    1-2 szóban, hogy mire is kell it figyelni. Sokmindenre nem:) A default interface résznél nálam ppp0 van, mert nekem a kapcsolat típusom PPPoE. A MaxBWeth0 8 nálam azért 8, mert lefelé 8mbit a sebességem.
    Szóval nálam így fest:

    # vnStat 1.6 config file
    ##

    # location of the database directory
    DatabaseDir "/opt/var/lib/vnstat"

    # locale (LC_ALL)
    Locale "hu_HU"

    # on which day should months change
    MonthRotate 1

    # date output formats for -d, -m, -t and -w
    # see 'man date' for control codes
    DayFormat "%m.%d."
    MonthFormat "%b '%y"
    TopFormat "%d.%m.%y"

    # characters used for visuals
    RXCharacter "%"
    TXCharacter ":"
    RXHourCharacter "r"
    TXHourCharacter "t"

    # default interface
    Interface "ppp0"

    # maximum bandwidth (Mbit) for all interfaces, 0 = disable feature
    # (unless interface specific limit is given)
    MaxBandwidth 100

    # interface specific limits
    # example 8Mbit limit for eth0 (remove # to activate):
    MaxBWeth0 8

    # how many seconds should sampling for -tr take by default
    Sampletime 5

    # default query mode
    # 0 = normal, 1 = days, 2 = months, 3 = top10
    # 4 = dumpdb, 5 = short, 6 = weeks, 7 = hours
    QueryMode 0

    # database file locking (1 = enabled, 0 = disabled)
    UseFileLocking 1

    # how much the boot time can variate between updates (seconds)
    BootVariation 15

    Majd létre kell hoznunk az adatbázisokat, a ppp0 helyett mindenki a saját interface-t írja be:

    (C)export PATH=/opt/bin:/opt/sbin:${PATH}
    export LD_LIBRARY_PATH=/opt/lib:/opt/usr/lib:/opt/usr/local/lib
    $1 $2 $3 $4 $5 $6
    vnstat -u -i ppp0
    vnstat -u -i br0
    vnstat -u -i eth0
    vnstat -u -i eth1(/C)

    Ha ilyen üzit kaptunk, akkor minden oké:
    Error:
    Unable to read database “/opt/share/vnstat/vlan1″.
    -> A new database has been created.

    Webes felületen:

    Administration->Scheduler->Custom1
    5 percenként minden nap

    export PATH=/opt/bin:/opt/sbin:${PATH}
    export LD_LIBRARY_PATH=/opt/lib:/opt/usr/lib:/opt/usr/local/lib
    $1 $2 $3 $4 $5 $6

    /opt/bin/vnstat -u
    /opt/bin/vnstat --dumpdb -i ppp0 > /nas/www/vnstat/vnstat_dump_ppp0
    /opt/bin/vnstat --dumpdb -i eth1 > /nas/www/vnstat/vnstat_dump_eth1
    /opt/bin/vnstat --dumpdb -i br0 > /nas/www/vnstat/vnstat_dump_br0
    /opt/bin/vnstat --dumpdb -i eth0 > /nas/www/vnstat/vnstat_dump_eth0

    Most már elvileg a cron segítségével 5 percenként frissülget az adatbázis, megvannak az emészthető formák is, most már csak a php frontend van hátra.
    Ez a legnehezebb az egészben:))
    Csomagoljuk ki a [frontendet] (nekem a 1.3-al sikerült) a web root alá mundjuk vnstat könyvtárba, majd nyissuk meg a config.php állományt.
    Nálam ennyi a tartalma (a szokásos cseréket persze mindenki végezze el):

    (C)<?php
    //
    // vnStat PHP frontend 1.3 (c)2006-2007 Bjorge Dijkstra (bjd@jooz.net)
    //
    // This program is free software; you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation; either version 2 of the License, or
    // (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with this program; if not, write to the Free Software
    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    //
    //
    // see file COPYING or at http://www.gnu.org/licenses/gpl.html
    // for more information.
    //

    //
    // configuration parameters
    //
    // edit these to reflect your particular situation
    //

    // list of network interfaces monitored by vnStat
    $iface_list = array('ppp0', 'br0', 'eth1', eth0);

    //
    // optional names for interfaces
    // if there's no name set for an interface then the interface identifier
    // will be displayed instead
    //
    $iface_title['ppp0'] = 'ppp0';
    $iface_title['br0'] = 'br0';
    $iface_title['eth1'] = 'eth1';
    $iface_title['eth0'] = 'eth0';

    //
    // There are two possible sources for vnstat data. If the $vnstat_bin
    // variable is set then vnstat is called directly from the PHP script
    // to get the interface data.
    //
    // The other option is to periodically dump the vnstat interface data to
    // a file (e.g. by a cronjob). In that case the $vnstat_bin variable
    // must be cleared and set $data_dir to the location where the dumps
    // are stored. Dumps must be named 'vnstat_dump_$iface'.
    //
    // You can generate vnstat dumps with the command:
    // vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface
    //
    $vnstat_bin = '';
    $data_dir = '/nas/www/vnstat';
    ?>(/C)

    Már majdnem kész vagyunk, de még kell egy kiegészítés a php-hoz (előfordulhat, hogy már valakinek fent van), hogy megkapjuk a grafikus függvényeket is az arcunkba. Ez a php-gd, amihez szépen sorban települ majd a többi összetevő is.

    ipkg install php-gd

    Én webszervernek a tomatoban lévő NGINX-et használtam a PHP Custom configuration ezt be kellet illesztenem: date.timezone = "Europe/Budapest"

    Ha valakinek sikerül a frontend 1.5.1-et működésre bírni az jelezze nekem.

    A forrást innen szettem : [link]

    [ Szerkesztve ]

Új hozzászólás Aktív témák