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!

Incorrect upload stats. Today I uploaded some files to cloud storage.. Total file size of multiple files was around 12-13 GB but vnstat shows I uploaded 53 GB which is impossible. My upload speeds is not fast enough for me to upload that much data is such short time.
View attachment 39628
HW acceleration enabled? If so, anything that modifies the IP stack can lead to variable accounting. If HW not enabled, advise on setup, connection speeds and topology, please.
 
HW acceleration enabled? If so, anything that modifies the IP stack can lead to variable accounting. If HW not enabled, advise on setup, connection speeds and topology, please.
NAT Acceleration is set to Auto. Had to set it to Auto otherwise my Wi-Fi speed doesn't go over 150-160 Mbps when it was set to disabled. I'm on a 300Mbps plan.
 
NAT Acceleration is set to Auto. Had to set it to Auto otherwise my Wi-Fi speed doesn't go over 150-160 Mbps when it was set to disabled. I'm on a 300Mbps plan.
To my knowledge HW acceleration has no bearing on wifi speed. In my experience, hardware, channel, and protocol (and power if available) is more likely to impact wifi speeds.

What is your wired speed with HW acceleration turned off? My AC66U_B1s - functionally equivalent to AC68U - have no issue reaching 300Mbps (wired) without HA. Wireless connectivity peaks around 200 or maybe a little over (AC 5gHz band).

With HA active, dn-vnstat results may be inaccurate. There's no workaround.
 
To my knowledge HW acceleration has no bearing on wifi speed. In my experience, hardware, channel, and protocol (and power if available) is more likely to impact wifi speeds.

What is your wired speed with HW acceleration turned off? My AC66U_B1s - functionally equivalent to AC68U - have no issue reaching 300Mbps (wired) without HA. Wireless connectivity peaks around 200 or maybe a little over (AC 5gHz band).

With HA active, dn-vnstat results may be inaccurate. There's no workaround.
I created a post when I had the speed issue and was advised to disable hardware acceleration, problem went away. Even wired speed was low with HW enabled. See results here
 
hello experts.. today I noticed something strange on vnstat.

this is the snapshot of top page of vnstat, and it is showing the date of 19th of Dec 2021 and somehow the month are not updated
to Jan 2022 and the eth0 daily also stopped at 19th of Feb

1645550535028.png


1645550654787.png



and this is the lower page from vnstat cli, and this is showing correct date and showing the correct daily usage

1645550585241.png



anyone have an idea how to fix this one, I'm afraid if I remove the vnstat the data will be lost.

thank you in advance for the advice.
 
hello experts.. today I noticed something strange on vnstat.

this is the snapshot of top page of vnstat, and it is showing the date of 19th of Dec 2021 and somehow the month are not updated
to Jan 2022 and the eth0 daily also stopped at 19th of Feb


and this is the lower page from vnstat cli, and this is showing correct date and showing the correct daily usage


anyone have an idea how to fix this one, I'm afraid if I remove the vnstat the data will be lost.

thank you in advance for the advice.
I'm at a loss to explain the December date except that it would have been the last time that vnstati actually created those images.

Have you tried to force update (uf at the dn-vnstat CLI) the app? Then wait a few mins and run a manual usage update (option 1).

If this doesn't do it, then try the command Jack describes here: https://www.snbforums.com/goto/post?id=729470. Then wait a few mins and run a manual usage update (option 1).

If the above didn't work, then uninstall the app, choosing NOT to delete the configuration. Reboot, and then reinstall (from amtm, just type vn and you will be prompted to install). If you want to "belt and suspenders" save your data, please see: https://www.snbforums.com/goto/post?id=707414. Then wait a few mins and run a manual usage update (option 1).
 
I'm at a loss to explain the December date except that it would have been the last time that vnstati actually created those images.

Have you tried to force update (uf at the dn-vnstat CLI) the app? Then wait a few mins and run a manual usage update (option 1).

If this doesn't do it, then try the command Jack describes here: https://www.snbforums.com/goto/post?id=729470. Then wait a few mins and run a manual usage update (option 1).

If the above didn't work, then uninstall the app, choosing NOT to delete the configuration. Reboot, and then reinstall (from amtm, just type vn and you will be prompted to install). If you want to "belt and suspenders" save your data, please see: https://www.snbforums.com/goto/post?id=707414. Then wait a few mins and run a manual usage update (option 1).
thanks a lot. it appears the solution from Jack solve the issues, because I just notice when I update the stats manually (opt 1) then I got an error missing libwebpdecoder.so.4.1.1:

thanks a lot for the information.

1645578410415.png


1645578419591.png
 
Hi all, I love this add-on but have never gotten into the email side of things. I took a closer look at that today and found the only option is daily emails. I was hoping for an option for monthly, might this be possible? I think the daily report looks nice, so my thought is "just" add some logic to only send on the first of the month (or billing reset date).

Thanks!
 
Hi all, I love this add-on but have never gotten into the email side of things. I took a closer look at that today and found the only option is daily emails. I was hoping for an option for monthly, might this be possible? I think the daily report looks nice, so my thought is "just" add some logic to only send on the first of the month (or billing reset date).

Thanks!
Appreciate the feedback. See this post, above yours. You can edit the cron job setting (you'll need to either over-ride the cronjob that sends the messaging, by creating a job with the same name in a script that runs after dn-vnstat starts to modify the frequency of communication) or you could edit the dn-vnstat script to change the frequency.

For the first option, dn-vnstat creates a cron job that emails a summary every day at 23.50 local (run a cru l and you'll see
59 23 * * * /jffs/scripts/dn-vnstat summary #dn-vnstat_summary#). In the default setup, the dn-vnstat script is launched from post-mount.

If you were to add a sleep command to the end of post-mount - for at least the timeout period of 600 seconds - then call cru a "dn-vnstat_summary" "0 0 1 1-12 * * /jffs/scripts/dn-vnstat summary", this would over-write the existing cron job to run the summary in the first few seconds of the new month (so you'd get the summary of the previous month).

The other option is to modify the dn-vnstat script itself (not recommended because it would be over-written if updated).

Cron jobs are like magic!

PS - there's probably a more elegant way of doing this - and I'm sure one of our cron/*nix experts will weigh in - but this is simple and reproducible, which is what I always prefer.
 
I think the daily report looks nice, so my thought is "just" add some logic to only send on the first of the month (or billing reset date).

@dev_null - adding my vote for you to kindly think about adding/integrating a monthly report option built into the script please, user selectable to be sent either on 1st of the month or on configured "Reset Day". Daily reports are way too much granularity for me, but a Monthly would be grand.

Thanks for your consideration!
 
Appreciate the feedback. See this post, above yours. You can edit the cron job setting [...] Cron jobs are like magic!
Cool! I hadn't thought of that....

As a quick hack I can simply change the crontab entry to monthly, and of course every time vnstat updates I'll get a daily email to "remind" me to re-edit :cool:

I forgot to mention, but part of my interest was I had an issue with the built-in stats which showed one day where I allegedly downloaded 800+ GB!! :eek: According to vnstat it was only 30 GB or so. Xfinity showed only 278 GB for the month, so vnstat wins! (vnstat reported 289 GB)

Thanks!
 
Last edited:
Cool! I hadn't thought of that....

As a quick hack I can simply change the crontab entry to monthly, and of course every time vnstat updates I'll get a daily email to "remind" me to re-edit :cool:

I forgot to mention, but part of my interest was I had an issue with the built-in stats which showed one day where I allegedly downloaded 800+ GB!! :eek: According to vnstat it was only 30 GB or so. Xfinity showed only 278 GB for the month, so vnstat wins! (vnstat reported 289 GB)

Thanks!
You might consider adding the over-ride cron job to post-mount, init-start (if present) and services-start as well. In different circumstances each of these can trigger a reload of certain scripts which might over-over-write your over-written cron job. If you get my point.

Having a cron job written multiple times - assuming it has the same job name - will not cause any issues.
 
Suggestion: Provide the means to have nsrum add a backup of the contents of your data file location. And, provide a way to merge old data into the current Sqlite data set. This would solve the problem of preserving and restoring data that would be lost if you need to redo your Merlin installation and to reload all user scripts from scratch including vnStat.
 
Suggestion: Provide the means to have nsrum add a backup of the contents of your data file location. And, provide a way to merge old data into the current Sqlite data set. This would solve the problem of preserving and restoring data that would be lost if you need to redo your Merlin installation and to reload all user scripts from scratch including vnStat.
You could try a variation on the backup script here: OpnWRT Vnstat. When you reboot it would back up the old files, and restore them on startup. I use it with my travel routers. Mind though, that you can't save it to the same place.
 
Suggestion: Provide the means to have nsrum add a backup of the contents of your data file location.
You can/should create 'nvram-user.sh' for additional nsru custom post-backup processing

e.g. my USB drive is mounted here /mnt/RT-AC68U/nsru/nvram-user.sh

sample post processing....backs up selected Entware NetData app data files and creates the .tar.gz (excluding the swap file if present) for copying to a remote (mapped) drive, but rsync could be used etc.
Code:
<snip>

cwd=$(dirname $(readlink -f $0))
if [ -d "$cwd/backup" ];then
    dwd="./backup/"
else
    dwd=
fi

# v384.13+ NVRAM variable 'lan_hostname' supersedes 'computer_name'
[ -n "$(nvram get computer_name)" ] && MYROUTER=$(nvram get computer_name) || MYROUTER=$(nvram get lan_hostname)

if [ -z $1 ];then
    echo -e $cBRED"\a"
    Say "***ERROR Expecting user to specify save id string in yyyymmddhhmm_MODEL-macid format"
    echo -e $cRESET
    exit 97
else
    [ ${1:0:1} == "-" ] && HYPHEN= || HYPHEN="-"
fi


Say "Creating nvram-backup"$1".tar.gz"
tar -zcvf "${dwd}nvram-backup${HYPHEN}"$1".tar.gz" "${dwd}nvram-restore${HYPHEN}"$1".sh" "${dwd}jffs${HYPHEN}"$1

# v384.13+ NVRAM variable 'lan_hostname' supersedes 'computer_name'
[ -n "$(nvram get computer_name)" ] && MYROUTER=$(nvram get computer_name) || MYROUTER=$(nvram get lan_hostname)

# Create backup of the netdata config
cp -u "/opt/etc/netdata/netdata.conf" /mnt/${MYROUTER}

if [ "$(which find)" == "/opt/bin/find" ];then
    # This 'find' command requires the Entware version which supports the '-maxdepth 1' arg
    echo -e $cBMAG
    Say "Creating '$MYROUTER.tar.gz'"
    echo -e "\n"$cBYEL
    /opt/bin/find /mnt/$MYROUTER -maxdepth 1 -type f \( ! -iname myswap.swp \) -print0 | xargs -0 tar -cvf ${dwd}$MYROUTER.tar.gz
else
    echo -e $cBRED$aBOLD$aBLINK"\a\n\t***ERROR Entware version of '/opt/bin/find' not found...Backup failed of '/mnt/$MYROUTER/.*'\n"$cRESET
fi

Say "Copying 'nvram-restore"$1"' to //DS-416/Asus"
cp "${dwd}nvram-restore${HYPHEN}$1.sh" "/mnt/$MYROUTER/DS-416/BackupScriptsJFFS"
 
You can/should create 'nvram-user.sh' for additional nsru custom post-backup processing

e.g. my USB drive is mounted here /mnt/RT-AC68U/nsru/nvram-user.sh

sample post processing....backs up selected Entware NetData app data files and creates the .tar.gz (excluding the swap file if present) for copying to a remote (mapped) drive, but rsync could be used etc.
Code:
<snip>

cwd=$(dirname $(readlink -f $0))
if [ -d "$cwd/backup" ];then
    dwd="./backup/"
else
    dwd=
fi

# v384.13+ NVRAM variable 'lan_hostname' supersedes 'computer_name'
[ -n "$(nvram get computer_name)" ] && MYROUTER=$(nvram get computer_name) || MYROUTER=$(nvram get lan_hostname)

if [ -z $1 ];then
    echo -e $cBRED"\a"
    Say "***ERROR Expecting user to specify save id string in yyyymmddhhmm_MODEL-macid format"
    echo -e $cRESET
    exit 97
else
    [ ${1:0:1} == "-" ] && HYPHEN= || HYPHEN="-"
fi


Say "Creating nvram-backup"$1".tar.gz"
tar -zcvf "${dwd}nvram-backup${HYPHEN}"$1".tar.gz" "${dwd}nvram-restore${HYPHEN}"$1".sh" "${dwd}jffs${HYPHEN}"$1

# v384.13+ NVRAM variable 'lan_hostname' supersedes 'computer_name'
[ -n "$(nvram get computer_name)" ] && MYROUTER=$(nvram get computer_name) || MYROUTER=$(nvram get lan_hostname)

# Create backup of the netdata config
cp -u "/opt/etc/netdata/netdata.conf" /mnt/${MYROUTER}

if [ "$(which find)" == "/opt/bin/find" ];then
    # This 'find' command requires the Entware version which supports the '-maxdepth 1' arg
    echo -e $cBMAG
    Say "Creating '$MYROUTER.tar.gz'"
    echo -e "\n"$cBYEL
    /opt/bin/find /mnt/$MYROUTER -maxdepth 1 -type f \( ! -iname myswap.swp \) -print0 | xargs -0 tar -cvf ${dwd}$MYROUTER.tar.gz
else
    echo -e $cBRED$aBOLD$aBLINK"\a\n\t***ERROR Entware version of '/opt/bin/find' not found...Backup failed of '/mnt/$MYROUTER/.*'\n"$cRESET
fi

Say "Copying 'nvram-restore"$1"' to //DS-416/Asus"
cp "${dwd}nvram-restore${HYPHEN}$1.sh" "/mnt/$MYROUTER/DS-416/BackupScriptsJFFS"
Yes, it takes a scripting expert to do these tasks. Thanks. I'll try a variation. Possibly Jack would consider making this a part of vnStat. But other than doing the backup, I would still need a script to get the data merged.
 
I would still need a script to get the data merged.
Not sure why it would need to be merged? Just save it someplace, then restore it after you've redone all your settings/scripts.
 
Not sure why it would need to be merged? Just save it someplace, then restore it after you've redone all your settings/scripts.
Well, if I restore right after I do the reinstall, then no, I would not need the merge. But if I wait a day or 2 or more, then I would like to merge to have as much of the historical data combined with the recent data as possible.
 
hello experts.. today I noticed something strange on vnstat.

this is the snapshot of top page of vnstat, and it is showing the date of 19th of Dec 2021 and somehow the month are not updated
to Jan 2022 and the eth0 daily also stopped at 19th of Feb

View attachment 39728

View attachment 39730


and this is the lower page from vnstat cli, and this is showing correct date and showing the correct daily usage

View attachment 39729


anyone have an idea how to fix this one, I'm afraid if I remove the vnstat the data will be lost.

thank you in advance for the advice.
May I know exactly what did you do to fix that issue?
I tried to to run those 2 commands in ssh
opkg remove vnstati2 libgd
opkg remove vnstati2 libwebp
And install again
opkg remove vnstati2
No success
Still have December 2022
 

Attachments

  • Screenshot_20230113-202412.jpg
    Screenshot_20230113-202412.jpg
    50.9 KB · Views: 40

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