You are not logged in.

#1 2015-10-16 07:35:59

tpfkanep
Member
From: South Africa
Registered: 2009-12-15
Posts: 131

vnstat query

I am getting weird stats from vnstat.

Daily (the days with -> are what I am querying)

     22/09/2015     4.03 GiB |    4.00 GiB |    8.03 GiB |  779.84 kbit/s
     23/09/2015    67.09 MiB |    2.64 MiB |   69.73 MiB |    6.61 kbit/s
     24/09/2015     3.91 MiB |     433 KiB |    4.33 MiB |    0.41 kbit/s
     25/09/2015    56.14 MiB |    3.72 MiB |   59.87 MiB |    5.68 kbit/s
     -> 26/09/2015     4.01 GiB |    4.00 GiB |    8.01 GiB |  777.69 kbit/s
     27/09/2015    67.50 MiB |    5.45 MiB |   72.95 MiB |    6.92 kbit/s
     28/09/2015    84.71 MiB |    4.29 MiB |   89.00 MiB |    8.44 kbit/s
     29/09/2015    32.71 MiB |    1.48 MiB |   34.20 MiB |    3.24 kbit/s
     30/09/2015    22.22 MiB |    1.89 MiB |   24.11 MiB |    2.29 kbit/s
     01/10/2015    51.85 MiB |    4.92 MiB |   56.77 MiB |    5.38 kbit/s
     02/10/2015   126.41 MiB |    8.47 MiB |  134.87 MiB |   12.79 kbit/s
     03/10/2015    22.75 MiB |    1.71 MiB |   24.46 MiB |    2.32 kbit/s
     -> 04/10/2015     4.03 GiB |    4.00 GiB |    8.03 GiB |  779.88 kbit/s
     05/10/2015    48.26 MiB |    5.40 MiB |   53.66 MiB |    5.09 kbit/s
     06/10/2015    60.54 MiB |    5.21 MiB |   65.75 MiB |    6.23 kbit/s
     07/10/2015    92.18 MiB |    8.07 MiB |  100.25 MiB |    9.51 kbit/s
     08/10/2015    34.98 MiB |    4.14 MiB |   39.13 MiB |    3.71 kbit/s
     09/10/2015    40.90 MiB |    4.44 MiB |   45.34 MiB |    4.30 kbit/s
     10/10/2015   260.98 MiB |    6.59 MiB |  267.57 MiB |   25.37 kbit/s
     -> 11/10/2015     4.19 GiB |    4.01 GiB |    8.20 GiB |  796.09 kbit/s
     12/10/2015    23.40 MiB |    3.13 MiB |   26.53 MiB |    2.52 kbit/s
     13/10/2015     8.18 MiB |    1.42 MiB |    9.60 MiB |    0.91 kbit/s
     14/10/2015    82.06 MiB |    5.27 MiB |   87.32 MiB |    8.28 kbit/s
     -> 15/10/2015     4.06 GiB |    4.01 GiB |    8.06 GiB |  782.92 kbit/s
     16/10/2015    57.45 MiB |    3.18 MiB |   60.63 MiB |   14.69 kbit/s

Monthly:

 ppp0  /  monthly

       month        rx      |     tx      |    total    |   avg. rate
    ------------------------+-------------+-------------+---------------
      Sep '15     21.86 GiB |   24.11 GiB |   45.96 GiB |  148.76 kbit/s
      Oct '15     13.18 GiB |   12.08 GiB |   25.26 GiB |  159.32 kbit/s
    ------------------------+-------------+-------------+---------------
    estimated     26.54 GiB |   24.32 GiB |   50.87 GiB |
 

The monthly values listed are way above my monthly plan of  2GB...

vnstat.conf:

# vnStat 1.13 config file
##

# default interface
Interface "ppp0"

# 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

# try to detect interface maximum bandwidth, 0 = disable feature
# MaxBandwidth will be used as fallback value when enabled
BandwidthDetection 1

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

# interface specific limits
#  example 8Mbit limit for 'ethnone':
MaxBWethnone 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 = exportdb, 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
##

# switch to given user when started as root (leave empty to disable)
DaemonUser ""

# switch to given user when started as root (leave empty to disable)
DaemonGroup ""

# 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

# how often (in minutes) bandwidth detection is redone when
# BandwidthDetection is enabled (0 = disabled)
BandwidthDetectionInterval 5

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

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

# create dirs if needed (1 = enabled, 0 = disabled)
CreateDirs 1

# update ownership of files if needed (1 = enabled, 0 = disabled)
UpdateFileOwner 1

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

# file used as daemon pid / lock file
PidFile "/var/run/vnstat/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            "-"

Any input will be appreciated.

Offline

#2 2015-10-16 10:09:44

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: vnstat query

You have logging on. What does the logfile say on those days?

Offline

#3 2015-10-16 10:18:20

tpfkanep
Member
From: South Africa
Registered: 2009-12-15
Posts: 131

Re: vnstat query

I checked for "/var/log/vnstat/vnstat.log" & cannot find the [vnstat] folder or the log file at the [LogFile] location as per settings.

Should I create the folder (although I see that the [CreateDirs] option is enabled)?

Offline

#4 2015-11-02 06:28:51

tpfkanep
Member
From: South Africa
Registered: 2009-12-15
Posts: 131

Re: vnstat query

After contacting the developer of vnstat and making suggested changes to vnstat.conf, vnstat has been running for more than 2 weeks with no problem. It is advisable to make these changes for 3G/4G devices.

vnstat.conf

# default interface
##

# interface specific limits
#  example 8Mbit limit for 'ethnone':
#MaxBWethnone 8
MaxBWppp0 8
MaxBWppp0.bak 8

# vnstatd
##

# how often (in seconds) interface data is updated
#UpdateInterval 30 <- default value.
UpdateInterval 10
vnstat author wrote:

The reason for those extra traffic spikes is caused by the default 1000 Mbit setting for devices that don't provide the maximum throughput value themselves. That value is fine for a wired connection but doesn't work well as a failsafe for a wireless connection, especially when a 32 bit kernel is used. When the device disconnects, it will reset it's traffic counter back
to zero. vnStat has to deduce when such even happens if it was caused by the traffic counter overflowing or if there was a value reset. Due to the 1000 Mbit setting, vnStat ends up assuming that the traffic counter did overflow and adds 2^32 = 4 GB to the database.

Offline

Board footer

Powered by FluxBB