What's new

[Beta] VNSTAT on Merlin; CLI, UI and email data use monitoring (install script offline for now)

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

Status
Not open for further replies.
OK thanks.

So to clarify, if 'ppp0' or 'vlan500' is used as the WAN interface (identified either automatically by the script or manually specified), then the GUI links (except for the CLI window) always fail?

I'll let the incumbent SME @dev_null identify/resolve the issue.
Yes, the only time I get the GUI links to work is with this
Code:
/jffs/scripts/vnstat-install.sh install eth0

From ifconfig, I can see eth0, ppp0 and vlan500 are having roughly the same RX and TX bytes count.
When I run tcpdump on eth0, all I see is PPPoE packets. For my case, I think I can make use of eth0 interface as WAN. Seems like the only extra in eth0 over ppp0 is the ppp encapsulation.
 
Yes, the only time I get the GUI links to work is with this
Code:
/jffs/scripts/vnstat-install.sh install eth0

From ifconfig, I can see eth0, ppp0 and vlan500 are having roughly the same RX and TX bytes count.
When I run tcpdump on eth0, all I see is PPPoE packets. For my case, I think I can make use of eth0 interface as WAN. Seems like the only extra in eth0 over ppp0 is the ppp encapsulation.
Appreciate the feedback regarding the interface counters.

I will leave the WAN interface identification patch in place as it will address the bug when identifying true ppp0 users but obviously at the expense of IPTV users.
 
This worked for me too
Code:
/jffs/scripts/vnstat-install.sh install eth0
 
A very minor comment about the email script portion. There is a warning that appears because the encrypt/decrypt code is deprecated. It is a very minor change in the script to update the code for the warning to disappear, but it has to appear in each of the 4 or 5 places in diversion that calls the code, and of course the existing password is encoded with the deprecated code and would have to be reentered and re-encrypted. Each update to Diversion would overwrite the correction until @thelonelycoder updates Diversion for the updated code. So I'm leaving the warning in place for the moment. See: https://www.snbforums.com/threads/error-message-during-curl-send-of-stats.68219/post-643013
 
A very minor comment about the email script portion. There is a warning that appears because the encrypt/decrypt code is deprecated. It is a very minor change in the script to update the code for the warning to disappear, but it has to appear in each of the 4 or 5 places in diversion that calls the code, and of course the existing password is encoded with the deprecated code and would have to be reentered and re-encrypted. Each update to Diversion would overwrite the correction until @thelonelycoder updates Diversion for the updated code. So I'm leaving the warning in place for the moment. See: https://www.snbforums.com/threads/error-message-during-curl-send-of-stats.68219/post-643013
... and when I do release the Diversion update, the password decrypt line needs to be updated in scripts that use it.
Until then, happy curl warning time ;)
 
Appreciate the feedback regarding the interface counters.

I will leave the WAN interface identification patch in place as it will address the bug when identifying true ppp0 users but obviously at the expense of IPTV users.
Thanks a lot @Martineau. From what I see, interface eth0 shows everything Ethernet frames, vlan id, PPP header, IP packets. In vlan500 interface vlan tag is stripped. PPP0 interface only shows IP packets.
 
Now, the automated updates are showing one hour less than manual - seems they are not respecting router timezone ... how to fix this ?

EDIT: not sure what helped, but I used full path to db (tmp/mnt/...) instead of /mnt/… in config file. And restarted. Now all is working again.
 
Last edited:
Now, the automated updates are showing one hour less than manual - seems they are not respecting router timezone ... how to fix this ?

EDIT: not sure what helped, but I used full path to db (tmp/mnt/...) instead of /mnt/… in config file. And restarted. Now all is working again.
Perhaps the S32 file needs the ExportTZ line, same as the S61unbound and others.
 
Perhaps the S32 file needs the ExportTZ line, same as the S61unbound and others.
Hm, after one hour it returns, and I found that probably S32 file was pointing to wrong dir for db. I modified it and will check after other rounds of updates ...
 
vnstat-install cannot remove the 'Vnstat/vnstati' addon GUI Tab as @dev_null's script to manage the GUI does not recognise or have any code to delete the tab

Code:
        # Remove Addons tab
        if [ -n "$(grep "uninstall)" /jffs/addons/vnstat.d/vnstat-ui)" ];then    # v1.07
            logger -st "$0" "Removing Addons GUI TAB"
            /jffs/addons/vnstat.d/vnstat-ui uninstall        # v1.07
        fi
However during the install vnstat.d/vnstat-ui apparently doesn't seem to correctly detect that its GUI tab already exists.

I'll let SME @dev_null address this issue.
I'm looking into this (asked for a consult with Jack Yaz on how connmon does it).


Now, the automated updates are showing one hour less than manual - seems they are not respecting router timezone ... how to fix this ?

EDIT: not sure what helped, but I used full path to db (tmp/mnt/...) instead of /mnt/… in config file. And restarted. Now all is working again.
I had vnstat report the wrong TZ on a couple of occasions early on. At that time I thought that it was starting up before the router time was set, so I checked the setting in vnstat.conf that sets how vnstat handles time discrepancies (extended the duration from 5 mins to 10 minutes). But a later install reset that to the default, and I never saw it again. So your solution is as good as mine...


Milan:
Hm, after one hour it returns, and I found that probably S32 file was pointing to wrong dir for db. I modified it and will check after other rounds of updates ...
The latest install instructions remove the recommendation for custom db location, based on the alpha testing results. Martineau's script doesn't make any changes. If you followed the early install instructions, you will need to keep updating the custom db location in any script update.

You should be able to copy the old db files (do both eth0 and the backup dot eth0) to the default (/opt/) location by doing a killall vnstat, move the db files and then restarting vnstat (execute /opt/bin/vnstat -u). If you do this, make sure your conf files all point to the installed default location.
 
Last edited:
I'm looking into this (asked for a consult with Jack Yaz on how connmon does it).
For the removal of the Addon GUI TAB, probably something like this?

Change
Code:
        Create_Dirs
        Mount_WebUI
to
Code:
LOCKFILE=/tmp/addonwebui.lock
FD=386

case $1 in                                                                # Martineau
    uninstall)
   
        eval exec "$FD>$LOCKFILE"
        flock -x "$FD"
   
        Get_WebUI_Page "$SCRIPT_DIR/vnstat-ui.asp"
        if [ -n "$MyPage" ] && [ "$MyPage" != "none" ] && [ -f "/tmp/menuTree.js" ]; then
            sed -i "\\~$MyPage~d" /tmp/menuTree.js
            umount /www/require/modules/menuTree.js
            mount -o bind /tmp/menuTree.js /www/require/modules/menuTree.js
            rm -rf "{$SCRIPT_WEBPAGE_DIR:?}/$MyPage"
        fi
       
        flock -u "$FD"
       
        Print_Output true "Unmounted $SCRIPT_NAME WebUI page as $MyPage" "$PASS"      
    ;;
    *)
        Create_Dirs
       
        eval exec "$FD>$LOCKFILE"
        flock -x "$FD"
       
        Mount_WebUI
       
        flock -u "$FD"
       
    ;;
esac
 
I have pushed Beta vnstat-install v1.07b3.

If anyone cares to test it primarily to see if immediately after a reboot the Addon GUI links are still broken.

Install link is in the following post
 
If anyone cares to test it primarily to see if immediately after a reboot the Addon GUI links are still broken.
It seemed to work properly. My reboot was wonky in some other respects (lost DDNS, the addons took a minute or two to mount) and while that had not happened before there are likely other things at work since I am on .2A2.
 
Hi, i installed it (updated) and now hab two tabs on the addons page, how can I unistall completly to reinstall the last version?
 
Hi, i installed it (updated) and now hab two tabs on the addons page, how can I unistall completly to reinstall the last version?
Reboot and it should be just one.
 
Hi, i installed it (updated) and now hab two tabs on the addons page, how can I unistall completly to reinstall the last version?
I'm working on it (with Jack Yaz and with input from Martineau). I need to test updated UI script this weekend.
 
Perfect! Good job!

I'm struggling with attaching the png to email, or at least puting it in-line.
 
Perfect! Good job!

I'm struggling with attaching the png to email, or at least puting it in-line.
If you're referencing the "daily report" email, it's either sent as a text file attachment (if using the send-vnstat script) or embedded as text in the email (if using the div-email.sh script). Which command do you have loaded in cron for the daily report? Please post or PM the vnstat-related output of cru l (that's a lowercase L - el).
 
Status
Not open for further replies.

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