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!

@dev_null
This script has been running so well, I was surprised to see something new was posted.
Thank You for your continued work!
Thank you (from both Jack and myself)! We've also been working on an update to incorporate vnStat 2.6, so while it was quiet above the waterline, it's been (somewhat) furious below the waterline! Stay tuned...
 
Need help.

Accidently flashed the ASUS firmware and reflashed Melin and ever since VNstats does not work. If I uninstall I get an error message and if I update of UF i get error messages and still does not work. What files / directories do i need to remove to manually delete VN stats so that i can start new?
 
Depending on what GPL version of the stock firmware you flashed, a full reset may be the fastest way to get your router back to a good/known state.

What other scripts do you use?

What specific Asus firmware did you flash? What RMerlin firmware were you and are you now running?
 
Depending on what GPL version of the stock firmware you flashed, a full reset may be the fastest way to get your router back to a good/known state.

What other scripts do you use?

What specific Asus firmware did you flash? What RMerlin firmware were you and are you now running?

Do not recall the exact version that I flashed, but currently running the most recent Merlin. Everything else is working find, but vnStats.
 

More details are never in vain. :)
 
Do not recall the exact version that I flashed, but currently running the most recent Merlin. Everything else is working find, but vnStats.
You should be more specific. The most current vnStat-on-Merlin tested version is 386.2_6. "Latest" really is meaningless when there are alpha and beta versions in the wild.

If you didn't reset your router after coming back from a non-Merlin build, you should. Some of the settings are different (nvram, etc) and even though things may appear to be working, this may not always be true.

That said, where I've seen the most issues is corruption of the two databases that vnStat (the app) uses to track usage (eth0 and .eth0) in the case of the AC68U. These are located in /opt/var/lib/vnstat/. You may wish to copy these somewhere off the router, though restoring them likely won't save your data, since they are already likely corrupted.

Here are the options you basically have at this point:
  1. If you haven't tried it, force an update with uf. Reboot to reinitialize the collection.
  2. If that doesn't work, uninstall with z, and when prompted, keep the database and config files. Reboot, then reinstall from amtm.
  3. If that doesn't work, uninstall with z, and when prompted, delete the database and config files. Reboot, then reinstall from amtm.
If none of this works, then you have an edge case. A full reset is called for, and don't restore any backups, manually re-add all settings, then follow the steps above.

EDIT: see also below - you could try running the manual commands to install/uninstall as well. These shouldn't differ from the built-in commands, but you never know.
 
Last edited:
Running 386.2_6 on AC68, updated AMTM to 3.2 FW and did the entware updates today also.

So originally had HW accel on and installed nvstat using "vlan2". Was reminded that the stats wouldn't be accurate with HW on, so turned it off and uninstalled and reinstalled vnstat via amtm to let it choose "eth0". Then got reminded why I had turned on HW accel in the first place, as my download speeds were cut in half.

So I turned HW accel back on, and after it rebooted I went into amtm to uninstall vnstat, but kept getting a warning that there was a lock file. So thought it was because of my change, changed HW accel back to off, and after the reboot was able to get into the vnstat menu. I tried uninstalling, and during the process there was an error

"/jffs/scripts/dn-vnstat: line 1831: arithmetic syntax error"

Tried it again for giggles, no dice. (along with "/jffs/scripts/dn-vnstat: line 1831: can't open /jffs/addons/dn-vnstat.d/vnstat-ui.asp: no such file" on the second attempt, not unexpected)

At this point, I tried doing what was mentioned in the previous post and doing an "uf" to see if a reinstall would clear something up, got some "/jffs/scripts/dn-vnstat: line 1: vnstati: not found" errors not found at the end. Trying to uninstall got the arithmetic syntax error again.

How should I clean this up? I don't need to save any of the data. Worst case, I can live without all the amtm,diversion,entware stuff I recently installed.
 
How should I clean this up? I don't need to save any of the data. Worst case, I can live without all the amtm,diversion,entware stuff I recently installed.
Couple things for future readers: the lock file is created when vnStat-on-Merlin is running (or has recently run) a refresh or an update. Scripts do this to prevent duplicate instances running in parallel. Most locks expire in 10 minutes or less. A reboot should clear the file as well, but is generally not needed. Second, the vnStat-on-Merlin script in no way affects the use of Diversion or other Entware scripts, it just uses each of those for different actions.

I'm not sure why a uf didn't fully re-install. Can you try running this version of the install command: /usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/de-vnull/vnstat-on-merlin/main/dn-vnstat.sh" -o "/jffs/scripts/dn-vnstat" && chmod 0755 /jffs/scripts/dn-vnstat && /jffs/scripts/dn-vnstat install

Note any error messages.

If that is successful (actually, even if it's not, since we're trying to uninstall), please run: /usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/de-vnull/vnstat-on-merlin/main/dn-vnstat.sh" -o "/jffs/scripts/dn-vnstat" && chmod 0755 /jffs/scripts/dn-vnstat && /jffs/scripts/dn-vnstat uninstall

Answer no to retaining configuration or data files. Note any error messages.

The first comand above should install the script and any dependencies and the second should remove everything. If this doesn't work then we might need to remove the components individually.
 
I have confirmed the "arithmetic syntax error" on uninstall in the R1 script, regardless of the approach. I'm working with Jack to get a fix in place.

For now I'd recommend against trying to uninstall as it may result in a partial-uninstall.
 
I have confirmed the "arithmetic syntax error" on uninstall in the R1 script, regardless of the approach. I'm working with Jack to get a fix in place.

For now I'd recommend against trying to uninstall as it may result in a partial-uninstall.

The hotfix allowed me to do a full uninstall and reinstall. Fixed the issue....

Keith
 
I have confirmed the "arithmetic syntax error" on uninstall in the R1 script, regardless of the approach. I'm working with Jack to get a fix in place.

For now I'd recommend against trying to uninstall as it may result in a partial-uninstall.
The hotfix allowed me to do a full uninstall and reinstall. Fixed the issue....

Keith
Good news. A hotfix to address the uninstall issue has been created by our esteemed @Jack Yaz .

A u update should apply the hotfix. A uf forced update should do the same.
 
v1.0.2 is now available
Changelog:
FIXED: Deletion of cron jobs on uninstall
FIXED: Detection of date for restting bandwidth warnings

@dev_null will be updating the relevant posts and docs in due course

With v1.0.2, I am getting a "! Data usage warning" even though bandwidth is set to unlimited (i.e., "0.00").

Screen Shot 2021-07-12 at 18.21.49.png


Also, I'm seeing a glitch in table display (large white block):
Screen Shot 2021-07-12 at 18.40.37.png


as well as error indicating that stats file is missing:
Screen Shot 2021-07-12 at 18.41.00.png


UPDATE: Reboot does not resolve. The same issues occur on three (3) different routers on three (3) different networks -- all running Merlin 363.3_beta2 firmware.
 
Last edited:
With v1.0.2, I am getting a "! Data usage warning" even though bandwidth is set to unlimited (i.e., "0.00").

@Jack Yaz

Hi Jack, yes I’m also getting this erroneous alert after updating to 1.0.2 even though I’m set to 3000 GB and am well under that, also I’m getting the

Code:
If you are seeing this message, it means you don't have a vntstat stats file present on your router.
Please use option 1 at the dn-vnstat CLI menu to create it

message as well. Running option 1 at CLI and refreshing GUI doesn’t fix it, although it did fix some of the missing graphs that I was also seeing.

Any thoughts? I also did the hot fix update this morning a few minutes prior to that if it makes a difference.

Update: Managed to get a chance to reboot router but still didn’t fix it, still showing erroneous Data Usage Warning and no vnstat CLI numbers in GUI.

Update 2: Your latest Hotfix plus toggling everything in sight in CLI off/on, re-entering Quota numbers etc, plus rebooting, seems to have fixed it!
Not sure which bit did the trick ... thanks Jack! :)
 
Last edited:
v1.0.2 hotfix appears to resolve all issues. Thanks!
 
Sorry, I'd have replied to dev_null's post, but my Bitdefender AV seems to think it's being attacked every time I tried replying to that message. Lets see if quick reply works...

Ok, did the install using your command and it looked good to a point, it asked if I wanted to use "vlan2" (HW accel is on). But at the end got these...

vnstati updating stats for UI

Error: Unable to read database "/opt/var/lib/vnstat/vlan2": No such file or directory (listed 8 times)

vnstat_totals summary generated

parse error: Invalid numeric literal at line 1, column 6
awk: cmd. line:1: Division by zero (listed 4 times)

Confirmed 1.0.2 is the installed version. Was able to uninstall without error at that point.

With that cleared out, I did the install again via amtm, and this time it was able to install without error and it seems functioning. I'm going to leave it running for now.

Thanks for the help.
 
v1.0.2 hotfix appears to resolve all issues. Thanks!

@Jack Yaz

Like @visortgw I though all issues were fixed, but now I'm not so sure or maybe behaviour has changed?

After not "visiting" the dn-vnstat GUI page for a few hours after I though everything was "fixed", I noticed that both the "Daily Usage" and "Top 10 Usage" tables were truncated with the bottom entries of both missing. I fixed it by manually doing a (GUI) "Update Stats", but I think the old behaviour was that a Refresh happened when you either first went to the tab or did a browser refresh? I have also tried clearing cache in Chrome and also other browsers but the issue seems to be persisting, but intermittently? Safari is consistently giving me "white blocks" for those two tables.

Anyone else seeing something similar?
 
Last edited:
@Jack Yaz

Like @visortgw I though all issues were fixed, but now I'm not so sure or maybe behaviour has changed?

After not "visiting" the dn-vnstat GUI page for a few hours after I though everything was "fixed", I noticed that both the "Daily Usage" and "Top 10 Usage" tables were truncated with the bottom entries of both missing. I fixed it by manually doing a (GUI) "Update Stats", but I think the old behaviour was that a Refresh happened when you either first went to the tab or did a browser refresh? I have also tried clearing cache in Chrome and also other browsers but the issue seems to be persisting, but intermittently? Safari is consistently giving me "white blocks" for those two tables.

Anyone else seeing something similar?
Happens sometimes when the images don't load. If you try a different browser you'll see they're intact, but for whatever reason even a force cache reload doesn't load the images correctly. V2 of this script is moving away from images for some things (chartjs instead) so less of an issue
 
Glad to hear the second hotfix helped

Well it didn't really as it turned out ... but

Happens sometimes when the images don't load. If you try a different browser you'll see they're intact, but for whatever reason even a force cache reload doesn't load the images correctly. V2 of this script is moving away from images for some things (chartjs instead) so less of an issue

at least explained the behavior I was seeing when I did further testing, so it's effectively "intermittent" for now?

Anyway, all good now I'm aware it's not a new bug as such, looking forward to seeing what you cook up with V2 @Jack Yaz !
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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