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!

Hotfix pushed - version to 2.0.5.

As noted above, unless you're using an iCloud address there is no urgent need to update.

Thanks to @bluzfanmr1 for identifying the issue and working to get it resolved.
 
ALso with an ax86u (non-pro and I can't get it to work either) but I did catch this in the log if it matters admin: Started vnstatd from .
 
ALso with an ax86u (non-pro and I can't get it to work either) but I did catch this in the log if it matters admin: Started vnstatd from .
I would need you to add a lot more information to this; please see the first post for details required to troubleshoot.
 
I ended up accidentally nuking my old data so rip, but hey it works now.
edit: or not, I don't see anything specific in the the first post?
 
Last edited:
I ended up accidentally nuking my old data so rip, but hey it works now.
edit: or not, I don't see anything specific in the the first post?

At the very least I'd need model number and firmware version, topology and other add-ons.

But a reset is always an option. It's likely that the reset has overwritten your previous stats.
 
It's an ax86u running 3004.388.6, I have just the swap file, vnStat, disk check, and the firmware and script update notification. It seems to be working for a bit and then jams, doing a restart or a stop and start doesn't seem to be helping it much. It has some bits of the previous stats as un the the cli bit in the ui under yearly it has this: estimated 34.07 TB | 318.48 TB | 352.55 TB
I don't super care that due to me not fully knowing how to grab the db before doing some screwery it lost bits, but rather it just not wanting to update.

Interface "eth0" which should be the 1 gb wan isn't it?

edit: Seems to be something with the usb drive.
 
Last edited:
It's an ax86u running 3004.388.6, I have just the swap file, vnStat, disk check, and the firmware and script update notification. It seems to be working for a bit and then jams, doing a restart or a stop and start doesn't seem to be helping it much. It has some bits of the previous stats as un the the cli bit in the ui under yearly it has this: estimated 34.07 TB | 318.48 TB | 352.55 TB
I don't super care that due to me not fully knowing how to grab the db before doing some screwery it lost bits, but rather it just not wanting to update.

Interface "eth0" which should be the 1 gb wan isn't it?

edit: Seems to be something with the usb drive.
It is entirely possible that a faulty/slow thumb drive can cause issues with scripting and Entware. If you read other threads, many recommend connecting an SSD rather than a thumb drive.

For most configurations, eth0 is the correct interface to be monitoring - what is your connection type (cable/DSL/fiber).

Generally dn-vnstat isn't killed or restarted under typical conditions. At the cli, what do you get when you run the command /opt/etc/init.d/S33vnstat check? If it says "dead" then something did kill the vnStat application (dn-vnstat is a wrapper for the underlying vnStat Linux app). You can try restarting vnStat with the command /opt/etc/init.d/S33vnstat start, but under normal conditions this shouldn't be necessary.

If you crank up the log level (if you're running scribe you'll need to either temporarily disable it to increase the level, or modify the nvram entry and reboot or restart the logging function), do you have any messages about vnStat? You can DM me logs if you'd rather not post them.
 
it is an an ssd. I'm guessing there may be something that either screwed up the permissions or the db got corrupted. It's fiber. vnstat runs but doesn't update the db while it's on the ssd, I do not fully know how to pull logs off of the router.
 
Running vnStat 2.0.5
GT-AX11000_Pro running Merlin 3004.388.6_0_rog (rest of details in signature)

Setup is new, had Google installed Friday last week, router was prepped Wednesday last week with an immediate update to Merlin from stock, out-of-the-box configuration before it was even swapped into service

Have had vnStat running for over 24 hours and still not getting any stats, just "eth5:Not enough data available yet."

Router is configured with Google 2gig on the 10G port (eth5) with failover to Spectrum on eth0.

all add-on packages installed are as current as they can get as of yesterday AM and are working as expected. Looking for advice on where to start digging in.

---- Things looked at so far ---

ASUSWRT-Merlin GT-AX11000_PRO 3004.388.6_0_rog Sat Jan 20 18:49:45 UTC 2024
James@GT-AX11000_Pro-8A30:/tmp/home/root# /opt/etc/init.d/S33vnstat check
/opt/etc/init.d/S33vnstat: .: line 53: can't open '/opt/etc/init.d/rc.func' <-- ??? not sure what's up here and if there is an underlying issue?


James@GT-AX11000_Pro-8A30:/tmp/home/root# cd /opt/var/lib/vnstat/
James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# ls -la
drwxrwxr-x 2 James root 4096 Feb 14 16:25 .
drwxrwxr-x 3 James root 4096 Feb 13 11:07 ..
-rw-r--r-- 1 James root 69632 Feb 13 11:07 vnstat.db <-- it exists but last update was yesterday

Current settings:

##################################################
## ##
## vnStat on Merlin ##
## for AsusWRT-Merlin routers ##
## ##
## v2.0.5 on GT-AX11000_Pro ##
## ##
## https://github.com/de-vnull/vnstat-on-merlin ##
## ##
##################################################

WebUI for dn-vnstat is available at:

1. Update stats now

2. Toggle emails for daily summary stats
Currently: ENABLED - HTML

3. Toggle emails for data usage warnings
Currently: ENABLED

4. Set bandwidth allowance for data usage warnings
Currently: 1200.00GB

5. Set unit for bandwidth allowance
Currently: GB

6. Set start day of cycle for bandwidth allowance
Currently: Day 1 of month

b. Check bandwidth usage now
You have used 0.00% (0.00GB) of your 1200.00GB cycle allowance; the next cycle starts on day 1 of the month.

v. Edit vnstat config

t. Toggle time output mode
Currently unix time values will be used for CSV exports

s. Toggle storage location for stats and config
Current location is usb
 
vnstat runs but doesn't update the db while it's on the ssd
Not saying I have the same problem or a solution, but on my AX88 it still does this (SSD or thumb drive) every couple of days. On my AX86 Pro, no issue for six months or more. I've noted this above and can't figure out what the problem might be.

EDIT: I've narrowed this down to vnstatd not starting on a reboot. S33vnstat start fixes it.
 
Last edited:
Running vnStat 2.0.5
GT-AX11000_Pro running Merlin 3004.388.6_0_rog (rest of details in signature)

Setup is new, had Google installed Friday last week, router was prepped Wednesday last week with an immediate update to Merlin from stock, out-of-the-box configuration before it was even swapped into service

Have had vnStat running for over 24 hours and still not getting any stats, just "eth5:Not enough data available yet."

Router is configured with Google 2gig on the 10G port (eth5) with failover to Spectrum on eth0.

all add-on packages installed are as current as they can get as of yesterday AM and are working as expected. Looking for advice on where to start digging in.

---- Things looked at so far ---

ASUSWRT-Merlin GT-AX11000_PRO 3004.388.6_0_rog Sat Jan 20 18:49:45 UTC 2024
James@GT-AX11000_Pro-8A30:/tmp/home/root# /opt/etc/init.d/S33vnstat check
/opt/etc/init.d/S33vnstat: .: line 53: can't open '/opt/etc/init.d/rc.func' <-- ??? not sure what's up here and if there is an underlying issue?


James@GT-AX11000_Pro-8A30:/tmp/home/root# cd /opt/var/lib/vnstat/
James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# ls -la
drwxrwxr-x 2 James root 4096 Feb 14 16:25 .
drwxrwxr-x 3 James root 4096 Feb 13 11:07 ..
-rw-r--r-- 1 James root 69632 Feb 13 11:07 vnstat.db <-- it exists but last update was yesterday

Current settings:

##################################################
## ##
## vnStat on Merlin ##
## for AsusWRT-Merlin routers ##
## ##
## v2.0.5 on GT-AX11000_Pro ##
## ##
## https://github.com/de-vnull/vnstat-on-merlin ##
## ##
##################################################

WebUI for dn-vnstat is available at:

1. Update stats now

2. Toggle emails for daily summary stats
Currently: ENABLED - HTML

3. Toggle emails for data usage warnings
Currently: ENABLED

4. Set bandwidth allowance for data usage warnings
Currently: 1200.00GB

5. Set unit for bandwidth allowance
Currently: GB

6. Set start day of cycle for bandwidth allowance
Currently: Day 1 of month

b. Check bandwidth usage now
You have used 0.00% (0.00GB) of your 1200.00GB cycle allowance; the next cycle starts on day 1 of the month.

v. Edit vnstat config

t. Toggle time output mode
Currently unix time values will be used for CSV exports

s. Toggle storage location for stats and config
Current location is usb
Thanks for the detail. First: I've never tested with dual-WAN, and have no way of testing that. However, having said that, I can't see why, as long as the correct interface is selected, it would work any differently.

The fact that /opt/etc/init.d/S33vnstat check gives something other than ...alive or ...dead indicates there is some sort of misconfiguration. I presume you've de-installed and re-installed? If you run /opt/etc/init.d/S33vnstat start , what output do you get from that?

What version of vnstat (the linux app) is installed vnstat -v (what version is Entware installing)?

In terms of interface, when you set it up, did dn-vnstat ID the interface correctly? Eth5 is unusual, so it's possible it was detected as eth0. You can check that by going to the dn-vnstat menu (command line version only), picking v (vee) then 1 (one) and looking for the line Interface and making sure it has your preferred interface listed. If you need to change it, save the file (CTRL+O) and exit (CTRL+X).

The other thing you can try is to toggle the storage (s) location to jffs, to see if it's something with the drive.

Are any other scripts acting up?
 
Nothing else acting up.

James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# /opt/etc/init.d/S33vnstat start
vnstat: Starting monitoring for interface eth5
/opt/etc/init.d/S33vnstat: .: line 53: can't open '/opt/etc/init.d/rc.func' <-- this returned again, wondering if something got goofed up with Entware install (it was done via AMTM).

---

James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# vnstat -v
vnStat 2.10 by Teemu Toivola <tst at iki dot fi>

I have toggled between jffs to USB and same result


--- semi truncated list of ifconfig ---- eth5 is the current active WAN connection, eth0 is hot standby WAN

James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# ifconfig
br0 Link encap:Ethernet HWaddr 08:BF:B8:91:8A:30
inet addr:192.168.1.253 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:15305513 errors:0 dropped:27 overruns:0 frame:0
TX packets:47328042 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1738022883 (1.6 GiB) TX bytes:65711218533 (61.1 GiB)

eth0 Link encap:Ethernet HWaddr 08:BF:B8:91:8A:31
inet addr:70.121.xxx.xxx Bcast:70.121.xxx.xxx mask:255.255.224.0
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:11460166 errors:0 dropped:0 overruns:0 frame:0
TX packets:455137 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1827471297 (1.7 GiB) TX bytes:42589382 (40.6 MiB)

eth5 Link encap:Ethernet HWaddr 08:BF:B8:91:8A:30
inet addr:136.50.xxx.xxx Bcast:136.50.xxx.xxx Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47907900 errors:0 dropped:152349 overruns:0 frame:0
TX packets:13913724 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67253142201 (62.6 GiB) TX bytes:2884447394 (2.6 GiB)
 
Nothing else acting up.

James@GT-AX11000_Pro-8A30:/tmp/mnt/AX11000_USB/entware/var/lib/vnstat# /opt/etc/init.d/S33vnstat start
vnstat: Starting monitoring for interface eth5
/opt/etc/init.d/S33vnstat: .: line 53: can't open '/opt/etc/init.d/rc.func' <-- this returned again, wondering if something got goofed up with Entware install (it was done via AMTM).

This is probably the key. For some reason, the vnstat application is not starting or is immediately crashing. I don't know if it's an Entware thing or something else.

Can you try to restart Entware (/opt/etc/init.d/rc.unslung restart) and then restart vnstat (/opt/etc/init.d/S33vnstat restart)? And then check the status with /opt/etc/init.d/S33vnstat check, and report on that?

I suppose a force reinstall of Entware might also be an option, though if other scripts are running it's unlikely to make a difference.

There's (perhaps) a similar rc.func issue (different application) and some potential solutions here: https://www.snbforums.com/threads/problem-mounting-opt-installing-entware.87517/page-3

Specifically, the script (which, in this case, would be S33vnstat) was run using screen to prevent it from being brought down or crashing.

Since I don't have the issue and you seem to be experienced with the command line, perhaps you could install screen (opkg install screen) and then testing by running s33vnstat start from the command line using screen or modifying the S33vnstat script, PREARG's line.

EDIT: once s33vnstat is running the rest of the dn-vnstat wrapper should also run, thus my focus on getting s33vnstat running.

Of the thousands of installs, it's a real head-scratcher why you and @elorimer are seeing this issue.
 
Well, something got very wonky with Entware it seems. rc.unslung and rc.func were missing completely anywhere. I suspect it may be the USB stick so...as much as I'd have liked to dig around and find a real root cause in case it wasn;t the USB stick, I took the nuclear route (gotta keep the better half happy, no streaming when she gets home==dead man!). Disabled scripts, rebooted, did a hard reset of AMTM, removed the USB stick and replaced with a spare SSD in enclosure and started over with fresh everything, confirming along the way that each thing worked and expected files were where they should be.

That seems to have done the trick, all the same add-ons installed, all verified working, most specifically vnstat!
 
Well, something got very wonky with Entware it seems. rc.unslung and rc.func were missing completely anywhere. I suspect it may be the USB stick so...as much as I'd have liked to dig around and find a real root cause in case it wasn;t the USB stick, I took the nuclear route (gotta keep the better half happy, no streaming when she gets home==dead man!). Disabled scripts, rebooted, did a hard reset of AMTM, removed the USB stick and replaced with a spare SSD in enclosure and started over with fresh everything, confirming along the way that each thing worked and expected files were where they should be.

That seems to have done the trick, all the same add-ons installed, all verified working, most specifically vnstat!
OK, glad you got it sorted.

@elorimer , likely not the same underlying issue, but when your router is not not collecting data, is vnstat running? I didn't realize you were still having problems.

EDIT: /opt/etc/init.d/S33vnstat check
 
I forgot to say THANK YOU! for the help, it got me digging around and, if nothing else, I learned a lot more about the underpinnings.
 
@elorimer , likely not the same underlying issue, but when your router is not not collecting data, is vnstat running? I didn't realize you were still having problems.
I'll have a go when it burps again. I count it a success to be again the sole, lonely and unique person with a problem on one router. :)


At the moment it is updating and running. But when things are stalled, I can use the UI page to "update stats" and it will run for a minute or so and then return the same old stats. I reacted to this because it seemed vnstat was running but not updating the db.

EDIT: The problem seemed to be that vnstatd didn't start running on a scheduled reboot. On a power cycle, it started. Rebooting from the webui, it started. Rebooting from a command line or on a scheduled reboot, it started. S33dnvstat restart started successfully. I edited S33dnvstat to eliminate the starting if coding and substitute a hard coded interface and storage location, and then it starts on a scheduled reboot and command line reboot.
 
Last edited:
I've changed my isp and iface has changed as well, let's say from usb0 to eth0 and now usb0 is secondary as usb1 with dualwan

gui still shows stats from usb0, I've changed Interface in vnstst.conf to eth0 but all stats are clear, when I leave Interface parameter empty for autodetection it starts with usb0.
my question is: can I assign all previous stats from usb0 to eth0 and monitor more than one iface?
I've tried to play with vnstat --add --remove --rename but it seems not to work as I assumed it will
 
I've changed my isp and iface has changed as well, let's say from usb0 to eth0 and now usb0 is secondary as usb1 with dualwan

gui still shows stats from usb0, I've changed Interface in vnstst.conf to eth0 but all stats are clear, when I leave Interface parameter empty for autodetection it starts with usb0.
my question is: can I assign all previous stats from usb0 to eth0 and monitor more than one iface?
I've tried to play with vnstat --add --remove --rename but it seems not to work as I assumed it will
@kfahoo just seeing this now.

  • I have not tested a USB modem, so I'm pleased that it worked.

  • I've not found a way to retain/convert previous stats from a different interface (the stats are kept in an sqlite db file, but editing that for interface and then reintegrating it has never been something I've been able to accomplish (full disclosure: I tried it back during development in 2020/2021 and not since). The file is located in /opt/var/lib/vnstat. It goes without saying, but backup before editing if you want to retain what has been collected. You will need to stop, edit the db file and restart vnStat (/opt/etc/init.d/S33vnstat stop > edit > /opt/etc/init.d/S33vnstat start).

  • In theory I believe that vnStat (the Linux application) can (and may, by default) monitor multiple interfaces, but my original intent for vnStat-on-Merlin was to enable me to monitor data usage (on a single interface) so I didn't exceed my then-ISP data cap. I never envisaged (and have no way to test) multiple interface monitoring. It may also be the case that the Entware version of vnStat may not accommodate multiple interfaces, but I suppose you could modify the vnstat.conf file to remove the specified interface (which in theory would instruct vnStat to monitor all interfaces). Again, you will need to stop, edit the conf file and restart vnStat (/opt/etc/init.d/S33vnstat stop > edit > /opt/etc/init.d/S33vnstat start).

  • If you want to monitor multiple interfaces from the command line, you could install nload and run that (using arrows to scroll through the interfaces). Install it via opkg install nload .
 
Last edited:

Latest threads

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