Coder Social home page Coder Social logo

Duplicated Entries about vnstat HOT 11 CLOSED

vergoh avatar vergoh commented on June 25, 2024
Duplicated Entries

from vnstat.

Comments (11)

vergoh avatar vergoh commented on June 25, 2024

That's some strange behaviour. Few questions:

  1. Was 1.14 already in use when those problems started?
  2. Your hostname suggests that's a laptop. What sort of connectivity/usage does wlan0 have, always connected or more like random usage with disconnects?
  3. Is hibernate and/or suspend getting used?
  4. Is ntpd configured and running?

Assuming the daemon was in use and you don't have a quick log discard, it would be interesting to see what the vnstatd output was around 31.7.2015. That could contain some clues why the duplicates happen.

from vnstat.

AlexMl avatar AlexMl commented on June 25, 2024
  1. I used 1.11-2 from the official ubuntu repositories and upgraded to the latest version in mid July. So the duplication happened with both versions.
  2. wlan0 is my main network device and it usually does not have disconnects.
  3. Suspend mode is used frequently hibernation not at all.
  4. ntpd is not installed/used

Unfortunately I only have syslogs from August which is weird but not related to this.
I switched to a different time zone and back some time ago. Do you think this is related.

from vnstat.

AlexMl avatar AlexMl commented on June 25, 2024

I just noticed that I changed the system time on the 31 of July.

from vnstat.

AlexMl avatar AlexMl commented on June 25, 2024

Ok Im pretty sure the duplicated entries are caused by changing the system time. Is there a way to edit the database of vnstat?

from vnstat.

vergoh avatar vergoh commented on June 25, 2024

Yes, that indeed appears to be the likely case. Either bad timing with the system time change or changing to a timezone far enough from the previous. I'll have to see if I could come up with some sort of sanity checker that would merge that kind of duplicated days/months when the database is loaded.

It's possible to edit the database like this:

  1. use --exportdb and pipe the output to a file
  2. modify the file, the format is explained in the vnstat(1) man page
  3. stop the daemon before import
  4. make a backup of the original database file
  5. use --importdb to import the modified text file
  6. check with vnstat that the modifications are as intended
  7. restart the daemon

If you don't mind, could you show the output of --exportdb before editing it. The timestamps are likely to give some idea how the duplication happens and how it could be either prevented or merged back.

from vnstat.

AlexMl avatar AlexMl commented on June 25, 2024

Here is the exported database: https://gist.github.com/AlexMl/758a22e8f75673196683

The time change was about 7 or 8 hours if it matters.

from vnstat.

AlexMl avatar AlexMl commented on June 25, 2024

I had time to fix the database today. Thanks for your help. Everything is fine again.
One last Question:

m;0;1438380001;81047;4361;897;955;1

What are the last three numbers for? I read the manpage but did not understand it.

from vnstat.

vergoh avatar vergoh commented on June 25, 2024

On that line, 897 is the rx KiB value for the current month and 955 is the corresponding tx value. This structure is due to vnStat historical reasons. For getting the rx value in KiB, you'd count 81047 * 1024 + 897 and in a similar way, tx for that line is 4361 * 1024 + 955.

The last number is either 0 or 1 depending on whether that line has already been filled by vnStat and it's being shown in outputs. Usually it will show everywhere as 1 if the database has been in use for longer than 11 months.

from vnstat.

Misiek304 avatar Misiek304 commented on June 25, 2024

It's happening for me too on my OpenWRT router. Sometimes when there's an power outage vnstat get's all messed up and it doubles the entries like in the screenshots above.

from vnstat.

vergoh avatar vergoh commented on June 25, 2024

Hopefully the switch to the sqlite database will make this problem go away as I don't have a good understanding how to replicate it in order to better understand what's happening and why. At least based on sqlite's documentation, it should be better at handling partially completed writes that are likely to happen during a power outage. I suspect that's something the filesystem in OpenWRT doesn't do be itself.

from vnstat.

vergoh avatar vergoh commented on June 25, 2024

sqlite database implementation has been merged from the branch to master and will be included in vnStat 2.0 release.

from vnstat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.