What's new

vnStat [Release] vnStat-on-Merlin - UI, CLI and email - data use and data limit monitoring - R1 and R2

  • 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!

Code:
quebec@RT-AC68U-20E0:/tmp/home/root# ls -la /jffs/addons/dn-vnstat.d
drwxrwxrwx    5 quebec   root             0 Jul 29 09:40 .
drwxr-xr-x   13 quebec   root             0 Jul 29 09:06 ..
-rw-rw-rw-    1 quebec   root             0 Jul 23 08:14 .v2upgraded
-rw-rw-rw-    1 quebec   root           228 Jul 29 09:06 .vnstatusage
-rw-r--r--    1 quebec   root            90 Jul 29 09:40 config
-rw-r--r--    1 quebec   root            91 Jul 29 09:05 config.bak
drwxrwxrwx    2 quebec   root             0 Jul 29 09:05 csv
drwxrwxrwx    2 quebec   root             0 Jul 29 09:05 images
drwxrwxrwx    2 quebec   root             0 Jul 29 09:05 v1
-rw-rw-rw-    1 quebec   root         53566 Jul 23 08:14 vnstat-ui.asp
-rw-rw-rw-    1 quebec   root          4633 Jul 29 09:06 vnstat.conf
-rw-rw-rw-    1 quebec   root          4633 Jul 29 09:04 vnstat.conf.bak
-rw-rw-rw-    1 quebec   root          4631 Jul 23 08:14 vnstat.conf.default
-rw-rw-rw-    1 quebec   root          3009 Jul 29 09:05 vnstat.txt
quebec@RT-AC68U-20E0:/tmp/home/root# ls -la /opt/share/dn-vnstat.d
drwxrwxrwx    5 quebec   root          4096 Jul 29 09:09 .
drwxr-xr-x   11 quebec   root          4096 Jul 29 09:09 ..
-rw-rw-rw-    1 quebec   root             0 Jul 29 09:09 .v2upgraded
-rw-rw-rw-    1 quebec   root           228 Jul 29 09:40 .vnstatusage
drwxrwxrwx    2 quebec   root          4096 Jul 29 09:40 csv
drwxrwxrwx    2 quebec   root          4096 Jul 29 09:40 images
drwxrwxrwx    2 quebec   root          4096 Jul 29 09:09 v1
-rw-rw-rw-    1 quebec   root          4627 Jul 29 09:09 vnstat.conf
-rw-rw-rw-    1 quebec   root          4631 Jul 29 09:09 vnstat.conf.default
-rw-rw-rw-    1 quebec   root          3009 Jul 29 09:40 vnstat.txt
Something funky is going on, the files should never be moved back. Once config is on USB then that will get set. I feel like a reinstall of the script would be a good idea. You can back up your traffic data from /opt/var/lib/vnstat/vnstat.db

Which firmware version are you on? And since its a 68u I have to ask, is it a legitimate 68u?
 
Something funky is going on, the files should never be moved back. Once config is on USB then that will get set. I feel like a reinstall of the script would be a good idea. You can back up your traffic data from /opt/var/lib/vnstat/vnstat.db

Which firmware version are you on? And since its a 68u I have to ask, is it a legitimate 68u?
Yes a legitimate 68U running 386.3. So If I backup this file vnstat.db, I won't loose history? Reinstall as in uninstall fully, delete all files then install again and how to restore the DB, just paste the file back?
 
Any reason why "Data usage" tabs on RT-AX68U with vnstat 2.0 are always empty?
 
How do I restore the vnstat.db file, I can't get the stats to reappear when I reinstalled it. all blank

keep saying


Error: Failed to get info value for "dbversion" from database (11): database disk image is malformed
Error: Failed to open database "/opt/var/lib/vnstat/vnstat.db" in read-only mode.

Tried uninstalling it and starting for scratch and now it says this:

Error: Interface "eth0" not found in database.
 
Last edited:
Hello all,

I have a secondary router (AC68u router mode) connected to my main router (AC86u router mode) and installed vnstat on the AC68u to hopefully track the usage only for users connected to it.

When setting up it asked if my default interface on the AC68u was vlan2, is this correct? I know on the main router it was eth0. I ask because I essentially am only using this to track neighbors who need to connect to this router via its guest wifi while keeping it isolated from my main network.

Thanks
 
@Jack Yaz not seeing monthly usage for current month in GUI, everything lse looks fine, even daily usage for current month looks good.
 
is vnstatd running/do you get daily usage? what day of month have you set?
yes I get daily usage. Oh sorry I've set it to 8th, my bad. Monthly image shows (01) for other months, does that mean it was set to start day 1 or what does (01) in bracket mean?

Capture.JPG
 
Hi - my ISP data resets on 14th of evry month. I have 14 set on VNSTAT day of month but its not resetting stats. Using latest version 2.0 and 386.3.2 on AC86U
 
Last edited:
@Jack Yaz , not sure if what I'm seeing is similar or different manifestation to @Khadanja or @joe scian.
If you recall a couple of pages back I noted that after upgrade to 2.0, and after re-setting my "rollover" day to Day 14, I was still seeing (01) instead of (14) in the stats for the monthly totals. From what I can tell the actual "amounts" are correct, and it DID reset last night (Sydney time), so it's purely a display error, but maybe it's linked to what the others are seeing.
I was waiting for the "new" month to rollover in case it corrected itself, but today they are all still saying (01).
I think you were going to look at whether a manual "fudge" on the database could be done to "make it look right" but maybe the issue goes deeper?


PreviewvnstatScreen Shot 14 Aug 2021 at 10.49.01.jpg
 
@Jack Yaz , not sure if what I'm seeing is similar or different manifestation to @Khadanja or @joe scian.
If you recall a couple of pages back I noted that after upgrade to 2.0, and after re-setting my "rollover" day to Day 14, I was still seeing (01) instead of (14) in the stats for the monthly totals. From what I can tell the actual "amounts" are correct, and it DID reset last night (Sydney time), so it's purely a display error, but maybe it's linked to what the others are seeing.
I was waiting for the "new" month to rollover in case it corrected itself, but today they are all still saying (01).
I think you were going to look at whether a manual "fudge" on the database could be done to "make it look right" but maybe the issue goes deeper?


View attachment 35693
this might actually be better answered by @Vergo
as far as I can tell the date format we're using is: MonthFormat "%Y-%m (%d)"

so I guess its simply pulling the date for the month, rather than referring to MonthRotate
 
How do I restore the vnstat.db file, I can't get the stats to reappear when I reinstalled it. all blank

keep saying


Error: Failed to get info value for "dbversion" from database (11): database disk image is malformed
Error: Failed to open database "/opt/var/lib/vnstat/vnstat.db" in read-only mode.

Tried uninstalling it and starting for scratch and now it says this:

Error: Interface "eth0" not found in database.
This sounds like an incomplete/improper set-up. To answer your questions specifically, it depends on whether you are on R1 or R2. For R2, all you need to do is copy the sqlite db, a hidden file called .vnstatusage CORRECTION : /opt/var/lib/vnstat/vnstat.db assuming you're on USB, otherwise this file in on JFFS. The location of that file depends on whether you store it in jffs (addons/dn-vnstat.d folder) or usb (opt/share/dn-vnstat.d folder). If you're on R1 you may be out of luck, but try to remove the install, save the data when prompted, then re-install. If the data still is readable, it should pick it up automatically. It may be worth trying an export of the data if you're on R1 - see the instructions on the github landing page.

Hello all,

I have a secondary router (AC68u router mode) connected to my main router (AC86u router mode) and installed vnstat on the AC68u to hopefully track the usage only for users connected to it.

When setting up it asked if my default interface on the AC68u was vlan2, is this correct? I know on the main router it was eth0. I ask because I essentially am only using this to track neighbors who need to connect to this router via its guest wifi while keeping it isolated from my main network.

Thanks
It depends on your setup. If it is just a downstream router with no other setup then eth0 should be correct. You could try each setting and see what is recorded. Usually the script is good about picking the right interface and the AC86u was one of the routers tested.

yes I get daily usage. Oh sorry I've set it to 8th, my bad. Monthly image shows (01) for other months, does that mean it was set to start day 1 or what does (01) in bracket mean?

View attachment 35474
For this and the next two issues: the date in parens is the monthly start date of statistics. The behavior of vnstat (the linux app, not the Merlin add-on) is that the data collection date re-starts on the month following the change in start date (see here). In my (our) R2 testing differing behavior between R1 and R2 was not observed, but I will go back and re-test this weekend.

Hi - my ISP data resets on 14th of evry month. I have 14 set on VNSTAT day of month but its not resetting stats. Using latest version 2.0 and 386.3.2 on AC86U
Is data still being shown in the previous month, or not recorded at all? Is your router date and time correct? Since this was a couple of days back, is it still not recording in the correct month?

@Jack Yaz , not sure if what I'm seeing is similar or different manifestation to @Khadanja or @joe scian.
If you recall a couple of pages back I noted that after upgrade to 2.0, and after re-setting my "rollover" day to Day 14, I was still seeing (01) instead of (14) in the stats for the monthly totals. From what I can tell the actual "amounts" are correct, and it DID reset last night (Sydney time), so it's purely a display error, but maybe it's linked to what the others are seeing.
I was waiting for the "new" month to rollover in case it corrected itself, but today they are all still saying (01).
I think you were going to look at whether a manual "fudge" on the database could be done to "make it look right" but maybe the issue goes deeper?
I'll look at this over the weekend. Again, I didn't test day 14 in R2. It could be that in R2 that type of display is deprecated, in which case we'll just remove it, but let's see.

Sorry for the delay in reading the recent posts. Last couple of weeks at a new job have been crazy with tech issues and I had some Home Assistant work that also required attention. Technology!
 
Last edited:
Again, I didn't test day 14 in R2. It could be that in R2 that type of display is deprecated, in which case we'll just remove it, but let's see.

Thanks @dev_null, it would be useful to have this working as per R1, as a little reminder about when your “month” actually started, as it does get a bit confusing otherwise.
 
Thanks @dev_null, it would be useful to have this working as per R1, as a little reminder about when your “month” actually started, as it does get a bit confusing otherwise.
Agreed, which is why it was added in the R1 version. I've been looking into it this afternoon and evening.
 
Couple things this morning (afternoon on the other side of the pond):

  • I've confirmed that the version of vnstat that R2 is based on handles certain flags differently than R1, particularly dates, and specifically the "month start" date we used in parens, and also the month name ("Aug" for %M). The workaround envisaged would actually change the "month start" to the "AllowanceStartDay", but that breaks the display in a different way: by changing that field regardless of the actual "month start" day (so even if January and February were monthstart=01, it would now show 14).

    Fortunately, the month start is listed in the same frame on the UI and is included in the summary emails. In the interest of accuracy, the best method of dealing with this is to remove it from the R2 monthly usage metrics. It will remain in R1 and we'll monitor to see if it can be reintroduced to R2.

    This update will probably be rolled out sometime this week (there are other things in the hopper that might be ready as well... stand by!).

  • I listed the incorrect location for the R2 database file. If you're saving on the USB, it's /opt/var/lib/vnstat/vnstat.db, otherwise this file is on JFFS. Calling this out to @jb68 particularly. A thousand apologies...
 
Last edited:
As promised, an updated version of vnStat-on-Merlin R2 is now available. There are no updates to R1 at this time.

This version (v. 2.0.1) includes the fix for the "month start" issue: remove "month start" field from monthly usage metrics. See notes here: https://www.snbforums.com/goto/post?id=707598.

With this version, there is a new feature: trend lines.

These are found in the interactive charts on the vnStat-on-Merlin UI page, and show trends in data usage over time - both download and upload. These trend lines are available in many of the interactive views: Data Usage (5 minutes, hours, days) and Compare Usage (days only).

These are shown with "dotted lines" (versus Max/Average/Min shown as dashed lines) and are toggle-able separately from Max/Average/Min lines.

What is a trend line? It's a line that is used to represent the behavior of a dataset to determine if there is a certain pattern or in this case, direction in terms of usage. I find them particularly useful after the mid-point in a month to get a feel for how our family data usage is doing against our limits.

Again, with much gratitude to @Jack Yaz for his support and collaboration!

Example:

Trendlines_1.PNG
 
Last edited:

Similar threads

Sign Up For SNBForums Daily Digest

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