## 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");
}}}}}}