qupfer
Goto Top

Vnstat und php interface - Nur default Interace zeigt aktuelle Werte (Rest nur nach manuellen update)

Hi liebe Gemeinde,

kleines aber unschönes Problem. Auf einen vServer habe ich vnstat und ein dazu ein php Frontend (http://humdi.net/vnstat/)
installiert.

Auf dem vServer exisiteren drei Interfaces, die ich dargestellt haben möchte. Venet0, tun0 und tap0. Jedoch zeigt nur venet0 aktuelle Werte an. tun/tap wird erst nach einen Aufruf von "vnstat -u" aktualisiert, also wenn manuell die Datenbanken aktualisiert wurden. Ist das normal oder wo habe ich den Fehler? Als Idee kam mir natürlich jetzt ganzpragmatisch einfach via cron alle x-minuten vnstat -u auszuführen, aber so recht gefallen will mir diese Lösung nicht. Also hoffe ich, auf bessere Vorschläge ;)

Vielen Dank und eine angenehme Restwoche
qupfer

/etc/vnstat.conf:
# vnStat 1.11 config file
##

# default interface
Interface "venet0"  

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

# locale (LC_ALL) ("-" = use system locale) 
Locale "-"  

# on which day should months change
MonthRotate 1

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

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

# how units are prefixed when traffic is shown
# 0 = IEC standard prefixes (KiB/MiB/GiB/TiB)
# 1 = old style binary prefixes (KB/MB/GB/TB)
UnitMode 0

# output style
# 0 = minimal & narrow, 1 = bar column visible
# 2 = same as 1 except rate in summary and weekly
# 3 = rate column visible
OutputStyle 3

# used rate unit (0 = bytes, 1 = bits)
RateUnit 1

# 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

# filesystem disk space check (1 = enabled, 0 = disabled)
CheckDiskSpace 1

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

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

# log days without traffic to daily list (1 = enabled, 0 = disabled)
TrafficlessDays 1


# vnstatd
##

# how often (in seconds) interface data is updated
UpdateInterval 30

# how often (in seconds) interface status changes are checked
PollInterval 5

# how often (in minutes) data is saved to file
SaveInterval 5

# how often (in minutes) data is saved when all interface are offline
OfflineSaveInterval 30

# force data save when interface status changes (1 = enabled, 0 = disabled)
SaveOnStatusChange 1

# enable / disable logging (0 = disabled, 1 = logfile, 2 = syslog)
UseLogging 2

# file used for logging if UseLogging is set to 1
LogFile "/var/log/vnstat.log"  

# file used as daemon pid / lock file
PidFile "/var/run/vnstat.pid"  


# vnstati
##

# title timestamp format
HeaderFormat "%x %H:%M"  

# show hours with rate (1 = enabled, 0 = disabled)
HourlyRate 1

# show rate in summary (1 = enabled, 0 = disabled)
SummaryRate 1

# layout of summary (1 = with monthly, 0 = without monthly)
SummaryLayout 1

# transparent background (1 = enabled, 0 = disabled)
TransparentBg 0

# image colors
CBackground     "FFFFFF"  
CEdge           "AEAEAE"  
CHeader         "606060"  
CHeaderTitle    "FFFFFF"  
CHeaderDate     "FFFFFF"  
CText           "000000"  
CLine           "B0B0B0"  
CLineL          "-"  
CRx             "92CF00"  
CTx             "606060"  
CRxD            "-"  
CTxD            "-"  


und /var/vnstat/config.php
<?php
    //
    // vnStat PHP frontend (c)2006-2010 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.
    //
    error_reporting(E_ALL | E_NOTICE);

    //
    // configuration parameters
    //
    // edit these to reflect your particular situation
    //
    $locale = 'en_US.UTF-8';  
    $language = 'en';  

    // list of network interfaces monitored by vnStat
    $iface_list = array('venet0', 'tun0', 'tap0');  

    //
    // optional names for interfaces
    // if there's no name set for an interface then the interface identifier  
    // will be displayed instead
    //    
    $iface_title['venet0'] = 'venet0';  
    $iface_title['tun0'] = 'tun0';  
    $iface_title['tap0'] = 'tap0';  

    //
    // 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 = '/usr/bin/vnstat';  
    //$data_dir = './dumps';  
    $data_dir = '/var/lib/vnstat';  

    // graphics format to use: svg or png
    $graph_format='svg';  
    
    // Font to use for PNG graphs
    define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');  

    // Font to use for SVG graphs
    define('SVG_FONT', 'Verdana');  

    // Default theme
    define('DEFAULT_COLORSCHEME', 'light');  

?>

Content-Key: 201645

Url: https://administrator.de/contentid/201645

Ausgedruckt am: 29.03.2024 um 10:03 Uhr