What's new

vnStat No data in Compare usage daily, weekly shows data

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Khadanja

Senior Member
Sometimes data loads on Days too if you fiddle around with the Unit & wait for some time but mostly it shows nothing. Tried different browsers..
1653021270218.png
 
ok weird but found a workaround. If I move my mouse curser few times left to right, data loads straightaway. Is there an issue on my side?
 
Last edited:
I'm in the same boat. All other tabs look ok to me, just this Compare Usage shows "No data to display" when on Days interval. Works fine for Weeks.
There is this topic with some clues but it seems like a different issue overall: dn-vnstat "no data to display" in "Data usage" and "compare usage" | SmallNetBuilder Forums (snbforums.com)

I have my vnstat DB files available to share - in case it's a data anomaly.
Just can't upload here, the forum won't allow me.
I don't seem to have that problem. It comes right up for me. It cycles through all the options instantly. I even used the same settings you were trying, @Khadanja ...

vnstat.JPG
 
I suspect I may have some data corruption.
In any case, I'll need assistance to fix it.
 
I suspect I may have some data corruption.
In any case, I'll need assistance to fix it.
Not sure how much assistance you'll be able to get to fix something so specific like this... your best bet might be to uninstall/reboot/reinstall... the only downside being, you'll lose all your previous stats.
 
This looks like Option 1.
Option 2: Read the DB, find the data causing errors (I have an idea which period to look for ) and delete only this portion.
 
Last edited:
Update 1:
Investigated the data.
There's a vnstatdata zip and a database: vnstat.db
The zipped csv file contains datarows like this:
Time,rx,tx
1654338600,329590,73962
1654338300,170295,86602
1654338000,653803,164939
1654337700,1665666,297552
1654337400,461336,126710.
I didn't see any inconsistency

Next, I found 3 tables in the DB:
fiveminute, hour, day.
Checked the data - looks very good.
For anyone who wants to check their data, here are the queries I used (replace the txt filenames with something that exists on your system):
Bash:
sqlite3 /opt/var/lib/vnstat/vnstat.db "select * from day" >> db_out_day.txt
sqlite3 /opt/var/lib/vnstat/vnstat.db "select * from hour" >> db_out_hour.txt
sqlite3 /opt/var/lib/vnstat/vnstat.db "select * from fiveminute" >> db_out_fiveminute.txt
The only anomaly (if I can call it so) is a time gap - a window of no data.
Looks like this in the fiveminute table
91|1|2022-05-31 21:25:00|14755877|3161144
92|1|2022-05-31 21:30:00|1853734|470504
93|1|2022-05-31 21:35:00|4652414|556729
94|1|2022-06-01 01:20:00|837735|205633
95|1|2022-06-01 01:25:00|557067|239716
96|1|2022-06-01 01:30:00|87197|56802
The series goes from 21:35 to 1:20.

Then, there's a similar gap in the hour table:
7|1|2022-05-31 19:00:00|74135041|8303662
8|1|2022-05-31 20:00:00|40981648|4356013
9|1|2022-05-31 21:00:00|32886089|5789282
10|1|2022-06-01 01:00:00|3513629|1103676
11|1|2022-06-01 02:00:00|12761162|3258084
12|1|2022-06-01 03:00:00|92374819|5389951
Goes from 21 to 1 o'clock.
That shouldn't break the stat page. If it does, this means any time there is a gap (for whatever reason), the daily view won't work.

What is the query that feeds the Compare Usage section?
 
Update 2:
Decided to restart the router (by the power switch on the back) and watch closely what happens to vnStat data.
Discovered an almost 24-hour data loss.

I did the forced restart around 13:20 today and this is how the database looked like shortly afterwards:
1098|1|2022-06-04 13:10:00|461336|126710
1099|1|2022-06-04 13:15:00|1665666|297552
1100|1|2022-06-04 13:20:00|653803|164939
1101|1|2022-06-04 13:25:00|170295|86602
1102|1|2022-06-04 13:30:00|329590|73962
1103|1|2022-06-05 13:20:00|306271|190422
1104|1|2022-06-05 13:25:00|854139|234211
1105|1|2022-06-05 13:30:00|120444|32123

Somehow everything between 13:30 on Jun 4 and 13:20 on June 5 is missing.
My initial conclusion was: data was deleted. But after I posted this idea I opened again the main script (dn-vnstat) and there was no "delete" statement there. Looked at the system log and there was the reason:
Jun 4 13:33:03 vnstatd[3778]: SIGTERM received, exiting.

Would it be possible to have a status flag on the page (like green / red box) indicating whether the service is healthy?
 

Attachments

  • Asus-vn-stat-problem.png
    Asus-vn-stat-problem.png
    128.6 KB · Views: 123
Last edited:
Update 3:
Here's what happened after I gave up searching what was wrong with my data.
As soon as the addon accumulated 1 week of statistics, the daily view of Compare Usage simply came to life on its own.
It is showing stats over last 7 days, so the problem is now clear. This view simply doesn't work properly unless it has data for the entire 7-day period.
 
Mine also started working :)
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top