Community discussions

MikroTik App
 
User avatar
BrasDeutscher
newbie
Topic Author
Posts: 41
Joined: Sat Sep 03, 2016 12:31 am
Location: Brazil

Hotspot E-Mail Notifer with Byte Info

Wed Sep 14, 2016 11:06 pm

## Hotspot Mail Notifer Byte Info ##
## Written by:BrasDeutscher,PA,Brazil ##
## Testet under RouterOS v6.37rc34 ##
{
:global gm
:global mac
:global ip
:global in
:global out
:global tot
:global mib
:global gib
:global upt
:global logout
:global send1
:global send2
:foreach i in=[/ip hotspot user find where (email~"@") ! dynamic ! default ! disabled ] do={
:set mac [/ip hotspot user get $i mac-address ];
:if ([/ip hotspot active find where mac-address=$mac ] != "" ) do={
:set logout [/ip hotspot active remove [find where mac-address=$mac ]];
:delay 5s;
:set ip [/ip hotspot active get [find where mac-address=$mac ] address ];
:set gm [/ip hotspot user get $i email ];
:set in [/ip hotspot user get $i bytes-in ];
:set upt [/ip hotspot user get $i uptime ];
:set out [/ip hotspot user get $i bytes-out ];
:set tot ($in + $out );
:set mib ($tot / 1024 / 1024 );
:set gib ($tot / 1024 / 1024 / 1024 );
:if ($tot > 1048576 ) do={
:if ("$tot" < 1073741824 ) do={
:set send1 [/tool e-mail send to="$gm" subject="Hotspot Info $mac" \
body="User $mac & Local IP $ip Byte Info $mib Mib & Uptime $upt" ];
:log warning ("User $mac & $gm & Byte Info $mib Mib & Uptime $upt");
} else={
:if ("$tot" > 1073741824 ) do={
:set send2 [/tool e-mail send to="$gm" subject="Hotspot Info $mac" \
body="User $mac & Local IP $ip Byte Info $gib Gib & Uptime $upt" ];
:log warning ("User $mac & $gm & Byte Info $gib Gib & Uptime $upt");
}}}}}}
 
dana1975
Frequent Visitor
Frequent Visitor
Posts: 94
Joined: Sat Jul 04, 2009 8:32 pm

Re: Hotspot E-Mail Notifer with Byte Info

Wed Jan 31, 2018 8:01 pm

m running CAPsMAN with 8 SSID and each SSID have the different IP Range
im usung hotspot + windows AD as radidus to authenticate all users
for one SSID i need a Script, i want to users have 200M daily usage and after that they speed change to 512Kbps
thank you in advance for your help

Who is online

Users browsing this forum: No registered users and 13 guests