What's new

[Beta 3] Vnstat on Merlin - UI, CLI and email - data use monitoring - now with data limit monitoring

  • 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.
@dev_null or @Jack Yaz please change line 679 here to not include quotes for the $SSL_FLAG variable, like so:
Code:
--user "$USERNAME:$PASSWORD" $SSL_FLAG
Or else curl throws this error:
Code:
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
dn-vnstat: Summary statistic email failed to send
i used this on the dev branch but haven't merged it to main yet: https://github.com/de-vnull/vnstat-on-merlin/commit/5426c3c488e9c9dbf663f51b82013155260cebcd

if I use your approach shellcheck will moan at me, but I can suppress it for that line
 
I'm not seeing that error with gmail's smtp, but clearly dn-vstat is using its formulation sending the stats. My other things emailing use the line as @thelonelycoder has it and don't throw an error either.

I'm still thinking it is better to have one script the router uses for all emails, passing the subject line, text and any attachment to it, and returning a result. When diversion changes to add the encryption flag we'll have to change a bunch of places.
dn-vnstat builds a MIME email currently for the HTML option, so we get inline images and possibility for other HTML goodies, and the plain text stats as an attachment. I didn't check to see what Diversion can do at the moment, so if it can do this we can switch. If not, Diversion is welcome to the code for the email generation.

I learnt more about boundaries and MIME parts than I ever thought I would!
 
i used this on the dev branch but haven't merged it to main yet: https://github.com/de-vnull/vnstat-on-merlin/commit/5426c3c488e9c9dbf663f51b82013155260cebcd

if I use your approach shellcheck will moan at me, but I can suppress it for that line
Please also replace the openssl check under "# Email settings #" to this for future and current compatibility with Diversion. Note that I explicitly use the system binary:
Code:
if /usr/sbin/openssl aes-256-cbc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # old OpenSSL 1.0.x
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
elif /usr/sbin/openssl aes-256-cbc -d -md md5 -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # new OpenSSL 1.1.x non-converted password
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc -d -md md5 -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
elif /usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # new OpenSSL 1.1.x converted password with -pbkdf2 flag
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
fi
The $emailPwEnc variable will be auto-included in Diversion's email.conf with the coming update.
 
Last edited:
dn-vnstat builds a MIME email currently for the HTML option, so we get inline images and possibility for other HTML goodies, and the plain text stats as an attachment. I didn't check to see what Diversion can do at the moment, so if it can do this we can switch. If not, Diversion is welcome to the code for the email generation.
Not at the moment, my elaborate hack was the first that allowed attachments for mails from our Asus routers. It was incredibly satisfying when the first mail attachment came through. My godson Thomas (hej då) was present at the time and I remember he was quite shocked at my enthusiastic reaction of that feat :)
 
Please also replace the openssl check under "# Email settings #" to this for future and current compatibility with Diversion. Note that I explicitly use the system binary:
Code:
if /usr/sbin/openssl aes-256-cbc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # old OpenSSL 1.0.x
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
elif /usr/sbin/openssl aes-256-cbc -d -md md5 -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # new OpenSSL 1.1.x non-converted password
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc -d -md md5 -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
elif /usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi >/dev/null 2>&1 ; then
    # new OpenSSL 1.1.x converted password with -pbkdf2 flag
    PASSWORD="$(/usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in /opt/share/diversion/.conf/emailpw.enc -pass pass:ditbabot,isoi)"
fi
The $emailPwEnc variable will be auto-included in Diversion's email.conf with the coming update.
done, on jackyaz-dev branch. im going to be working on some WebUI stuff tomorrow, I'll submit a PR to port it to main when I'm done
 
Not at the moment, my elaborate hack was the first that allowed attachments for mails from our Asus routers. It was incredibly satisfying when the first mail attachment came through. My godson Thomas (hej då) was present at the time and I remember he was quite shocked at my enthusiastic reaction of that feat :)
haha i've done that! i realise i could have looked to leverage the "makemime" utility, but that didn't seem as fun
 
done, on jackyaz-dev branch. im going to be working on some WebUI stuff tomorrow, I'll submit a PR to port it to main when I'm done
Looks good, tested on current and future Diversion installations. Thanks.
 
Hi @JohnD5000,

I have also a RT-AC86U and have noticed that your seem to be missing the "Intercept NTP client requests" option and that your "DST time zone changes ends" have been set to the second Sunday of October, which should be the first Sunday of November:

View attachment 31640
View attachment 31644
Therefore it is possible that your reported issues might be related of corruptions in your router configuration.

I'm pretty sure these are default settings from Merlin (I don't recall ever changing them except maybe the time zone).

The Intercept NTP client requests shows up if I select Yes for Enable local NTP server. I'm not sure if I should do that. (I'm not even sure what it does). I will make the DST time though.

Also, I just added ntpMerlin script and changed that from NTPD to Chrony. I don't think that matters when doing a reboot, but I read it is suppose to improve network system so why not.
 
I am pleased to now support Vnstat in amtm, see the release thread for amtm 3.1.9.
This is the first time that amtm adds a script still in beta, so please be gentle with the Vnstat developers ;)
 
I have diversion working and mails sending correctly, however when I try to activate email sending in vnstats, it throws this error...
 

Attachments

  • Screenshot_20210306-230552258.png
    Screenshot_20210306-230552258.png
    363.5 KB · Views: 117
I have diversion working and mails sending correctly, however when I try to activate email sending in vnstats, it throws this error...
See above posts with @Jack Yaz and me, a fix it's coming in an Vnstat update.
Edit: Actually, this is somewhat a different problem than I originally thought I saw in your screenshot. Sorry mate.
 
Installed latest version via amtm. Very well done team.


The only issue I have is option 2. Toggle emails for daily summary stats. Shows currently DISABLED. When I choose option 2 HTML it actually sends the email just fine however the following messages are generated AND option 2. Toggle emails for daily summary stats. remains DISABLED.

Code:
dn-vnstat: Attempting to send summary statistic email

dn-vnstat: Summary statistic email failed to send

ps - this is easily fixed as per thelonelycoder post #39 - sorry for not reading that post.
 
Last edited:
Try switching to develop branch, you might have a broken entware version of openssl. I'd love to know what you do to your setup because you always have weird problems!
Indeed :p:p
I switched to your dev branch, same occurs.
However the email is sent just fine, despite the errors

Next step is to have own mail sending service, t not rely on diversion...
 
Indeed :p:p
I switched go your dev branch, same occurs.
However the email is sent just fine, despite the errors

Next step is to have own mail sending service, t not rely on diversion...
Then you have something very broken with OpenSSL by the looks of it.

No plans to do so at this time
 
Next step is to have own mail sending service, t not rely on diversion...
I have no hand in this, it is a matter of convenience for some to reuse what's already there.
 
I have no hand in this, it is a matter of convenience for some to reuse what's already there.
I know pal :)

Offtopic - suggestion for amtm - have its own global email sending service - so devs can use it's api for their own scripts. Instead of diversion

Handy?
 
I know pal :)

Offtopic - suggestion for amtm - have its own global email sending service - so devs can use it's api for their own scripts. Instead of diversion

Handy?
Well, I've had this discussion before. But I will consider the option for a future amtm update.
 
Just noticed the addition of vnstat with the latest amtm, and as I have liked vnstat for some time (and run it on a remote VPS), I've installed it on my AC-RT86U/386.1_2. All went smoothly, it worked immediately, no warnings or higher in the router logs.

Nice to have vnstat.conf, so that I can change the date format to suit a UK eye. Not sure what OS/browser that CTRL/F5 might work on (cmd/SHIFT/R for me) but the "hard refresh" note was useful.

Just managed to find an error with:
Code:
opkg info vnstat
giving:
Code:
Collected errors:
 * file_sha256sum_alloc: Failed to open file /opt/etc/vnstat.conf: No such file or directory.
Doesn't appear to be a problem.

This all looks like a lot of work for several people, thanks to all.
 
Just noticed the addition of vnstat with the latest amtm, and as I have liked vnstat for some time (and run it on a remote VPS), I've installed it on my AC-RT86U/386.1_2. All went smoothly, it worked immediately, no warnings or higher in the router logs.

Nice to have vnstat.conf, so that I can change the date format to suit a UK eye. Not sure what OS/browser that CTRL/F5 might work on (cmd/SHIFT/R for me) but the "hard refresh" note was useful.

Just managed to find an error with:
Code:
opkg info vnstat
giving:
Code:
Collected errors:
* file_sha256sum_alloc: Failed to open file /opt/etc/vnstat.conf: No such file or directory.
Doesn't appear to be a problem.

This all looks like a lot of work for several people, thanks to all.
We use a specific file in the /jffs/addons dir and remove the /opt/etc config to avoid confusion
 
Status
Not open for further replies.

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