Send user notification on data usage
Dear All, We are using freeradius to control our WiFi hotspot. We have implemented FUP limits for users based on day/week/month.<br/> Now, we want to send a user notification if the user has used - let's say 80% of daily allowed limit, informing that data is about to finish, in the form of email/sms.<br/> I have 2 ways to implement it -<br/> 1. Some hook at freedaius side which can look at consumption in interim updates and based on logic call a webservice(or anything else) which will further take care of notification sending part.<br/> 2. Have a bot which will constantly read on radacct table and will send notification if required.<br/> I am more inclined towards approach 1 as it would be a neat and fast way of doing it. Reading a highly transaction table such as radacct is no good idea. Kindly suggest. <br/> Thanks,Sachin.
On Mar 14, 2017, at 9:44 AM, Sachin Yadav via Freeradius-Users <freeradius-users@lists.freeradius.org> wrote:
We are using freeradius to control our WiFi hotspot. We have implemented FUP limits for users based on day/week/month.<br/>
What's a FUP limit?
Now, we want to send a user notification if the user has used - let's say 80% of daily allowed limit, informing that data is about to finish, in the form of email/sms.<br/> I have 2 ways to implement it -<br/> 1. Some hook at freedaius side which can look at consumption in interim updates and based on logic call a webservice(or anything else) which will further take care of notification sending part.<br/>
You can write if / then / else logic in FreeRADIUS. And then run a script which sends email.
2. Have a bot which will constantly read on radacct table and will send notification if required.<br/>
Even once an hour should be good enough.
I am more inclined towards approach 1 as it would be a neat and fast way of doing it. Reading a highly transaction table such as radacct is no good idea. Kindly suggest.
It's up to you. I don't think it matters much either way. If you have decent indexes on the table, a SELECT of users with 80% utilization should take almost no resources. And, you'll need to track which users got an email already. Which means writing that information to the DB. And you'll have to do this for both situations, above. Alan DeKok.
Thanks a lot Alan for your reply. FUP is fair usage policy, how much data a user consumed in a fixed timeframe. -- You can write if / then / else logic in FreeRADIUS Would you be kind enough to provide an example or few lines on where exactly I can put this logic in freeradius? On Wednesday, March 15, 2017 7:10 PM, Alan DeKok <aland@deployingradius.com> wrote: On Mar 14, 2017, at 9:44 AM, Sachin Yadav via Freeradius-Users <freeradius-users@lists.freeradius.org> wrote:
We are using freeradius to control our WiFi hotspot. We have implemented FUP limits for users based on day/week/month.<br/>
What's a FUP limit?
Now, we want to send a user notification if the user has used - let's say 80% of daily allowed limit, informing that data is about to finish, in the form of email/sms.<br/> I have 2 ways to implement it -<br/> 1. Some hook at freedaius side which can look at consumption in interim updates and based on logic call a webservice(or anything else) which will further take care of notification sending part.<br/>
You can write if / then / else logic in FreeRADIUS. And then run a script which sends email.
2. Have a bot which will constantly read on radacct table and will send notification if required.<br/>
Even once an hour should be good enough.
I am more inclined towards approach 1 as it would be a neat and fast way of doing it. Reading a highly transaction table such as radacct is no good idea. Kindly suggest.
It's up to you. I don't think it matters much either way. If you have decent indexes on the table, a SELECT of users with 80% utilization should take almost no resources. And, you'll need to track which users got an email already. Which means writing that information to the DB. And you'll have to do this for both situations, above. Alan DeKok.
On Wed, Mar 15, 2017 at 02:34:52PM +0000, Sachin Yadav via Freeradius-Users wrote:
-- You can write if / then / else logic in FreeRADIUS
Would you be kind enough to provide an example or few lines on where exactly I can put this logic in freeradius?
See man unlang (available at http://freeradius.org/radiusd/man/unlang.html). There are lots of examples on the wiki at http://wiki.freeradius.org It goes in the virtual server configuration files in raddb/sites-enabled/ Matthew -- Matthew Newton, Ph.D. <mcn4@leicester.ac.uk> Systems Specialist, Infrastructure Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk>
participants (3)
-
Alan DeKok -
Matthew Newton -
Sachin Yadav