Email,SMS notification
Moderator: Moderators
-
- Posts: 4
- Joined: Fri Aug 30, 2019 6:29 pm
Email,SMS notification
Hi all,
I was wondering if the email notification could be coded for the quota management? Here is what I would like to accomplish, I have a guest account for a airbnb style rental (Monthly). I include 40 Go a month, which of course shuts off by quota management, but would like to send notification via sms when user reaches 50%, 90%, ect... like the major cell phone providers do. This would be a very nice feature which would put less stress to my life when the phone rings at midnight because they lost internet... Thanks
I was wondering if the email notification could be coded for the quota management? Here is what I would like to accomplish, I have a guest account for a airbnb style rental (Monthly). I include 40 Go a month, which of course shuts off by quota management, but would like to send notification via sms when user reaches 50%, 90%, ect... like the major cell phone providers do. This would be a very nice feature which would put less stress to my life when the phone rings at midnight because they lost internet... Thanks
Re: Email,SMS notification
You can roll your own script for this which checks the quote values and then triggers an email if needed.
You can use the "print_quotas" command on a cron schedule, and the email notifications plugin to provide you with the email sending utility.
You can use the "print_quotas" command on a cron schedule, and the email notifications plugin to provide you with the email sending utility.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
Please be respectful when posting. I do this in my free time on a volunteer basis.
-
- Posts: 4
- Joined: Fri Aug 30, 2019 6:29 pm
Re: Email,SMS notification
Thanks, I understand the dynamic side of this, but im not a shell script programmer, if someone could help me out a bit it would be appreciated
Re: Email,SMS notification
A few suggestions without writing a script
1) Simply ask them to check the usage from the router page, login not required
2) Throttle their speed, not cut it off when limited is reached
3) Consider changing your quota limit to reset per day/hour/week rather than per month
1) Simply ask them to check the usage from the router page, login not required
2) Throttle their speed, not cut it off when limited is reached
3) Consider changing your quota limit to reset per day/hour/week rather than per month
Eric Wong
PM me if you need to buy Gargoyle router in Australia/NZ, willing to pay me to help you on your Gargoyle configurations or build custom configured ROM with pre-installed app or try to fix your bricked router. Yes, I am looking for job/work.
PM me if you need to buy Gargoyle router in Australia/NZ, willing to pay me to help you on your Gargoyle configurations or build custom configured ROM with pre-installed app or try to fix your bricked router. Yes, I am looking for job/work.
Re: Email,SMS notification
I have written such a script. Just a few lines really. It emails only when >=99%. I set it to run every 10 min in cron. I dont think the Priority works but left it in there.
Contents of mail_template_quota.txt
The actual quota group/name and values get append to the end of the email body.
Code: Select all
#!/bin/sh
current_date_time=$(date +"%Y-%m-%d-%H-%M-%S")
print_quotas | grep quotaPercents |grep -v "\= \[\];"|grep -v " 0.000," |grep -v "var quotaPercents" |awk '/\]\[/{sub(/.*\]\[ /, "");print}' |awk '{print $1, $5}'| cut -c 2- |sed 's/.$//'|sed 's/"//'| sed 's/"//' | awk '{ if($2 >= 99) { print } }' > quota_email_output.txt
if [ -s quota_email_output.txt ]
then
cat ../mail_template_quota.txt > "mail_alert_$current_date_time.txt"
print_quotas |grep quotaPercents |grep -v "\= \[\];"|grep -v " 0.000," |grep -v "var quotaPercents" |awk '/\]\[/{sub(/.*\]\[ /, "");print}' |awk '{print $1, $5}'| cut -c 2- |sed 's/.$//'|sed 's/"//'| sed 's/"//' | awk '{ if($2 >= 99) { print } }' >> mail_alert_$current_date_time.txt
cat "mail_alert_$current_date_time.txt" | msmtp username@domain.com
fi
Code: Select all
To: user@domain.com
From: user@gmail.com
Subject: Gargoyle Quota Warning
X-Priority:1
User has exceeded their quota
Linksys WRT32x Wired Gateway, Orbi RBK20 Wifi
Linksys WRT32x Wired Gateway, Orbi RBK50 Wifi
Linksys WRT32x Wired Gateway, Orbi RBK50 Wifi
Re: Email,SMS notification
Nice, that's pretty cool!
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
Please be respectful when posting. I do this in my free time on a volunteer basis.
EmailSMS notification
Just for reference, I think you went to "Settings", "General", Messaging & Notification where the second option is -Default Thread Subscription Mode -there are 5 options. Off is by default.
ff
ff
Re: Email,SMS notification
Instead of using print quotas you would need to use the bw_ commands. It that is a non trivial change. Unless your quota is for the whole system.
Linksys WRT32x Wired Gateway, Orbi RBK20 Wifi
Linksys WRT32x Wired Gateway, Orbi RBK50 Wifi
Linksys WRT32x Wired Gateway, Orbi RBK50 Wifi