Page 1 of 1

reading hotspot users details

Posted: Tue Apr 08, 2014 1:17 am
by obadaabdullah
hi all
RB951 V6.7, hotspot ( username & password) i give my users a limit-bytes-total
i want to read my users remain bytes
i try this script but it was wrong

:foreach i in=[/ip hotspot user find] do={
local bi [/ip hotspot user get $i bytes-in]
local bo [/ip hotspot user get $i bytes-out]
local user [ip hotspot user get $i user]
log info "user $user and bi $bi and bi $bo"
}

any help pleas?
and if it is possible can i write this value to a txt file in the rb??
thanks

Re: reading hotspot users details

Posted: Tue Apr 08, 2014 3:39 pm
by rextended
Use right syntax (6.7+):
:foreach tmpI in=[/ip hotspot user find where (limit-bytes-total > 0)] do={
:local tmpName value=[/ip hotspot user get $tmpI value-name=name];
:local tmpLimitTotal value=[/ip hotspot user get $tmpI value-name=limit-bytes-total];
:local tmpIn value=[/ip hotspot user get $tmpI value-name=bytes-in];
:local tmpOut value=[/ip hotspot user get $tmpI value-name=bytes-out];
:local tmpRemaining value=($tmpLimitTotal - ($tmpIn + $tmpOut));
:local tmpMessage value=("User: ".$tmpName.", Limit Total: ".$tmpLimitTotal.", Used In: ".$tmpIn.", Used Out: ".$tmpOut.", Remaining Total:".$tmpRemaining);
:if ([/ip hotspot user get $tmpI value-name=disabled]) do={:set tmpMessage value=("USER DISABLED: ".$tmpMessage);};
:if ($tmpRemaining < 1) do={:set tmpMessage value=("USER OUT OF BYTES: ".$tmpMessage);};
:log info message=$tmpMessage;
}
Is possible to write output to text file, each 100 users, using different file names.
Is not possible to store, on each file, more than 4096 Characters.

If I helped you, please add Karma.

Re: reading hotspot users details

Posted: Thu Apr 10, 2014 10:40 am
by obadaabdullah
Use right syntax (6.7+):
:foreach tmpI in=[/ip hotspot user find where (limit-bytes-total > 0)] do={
:local tmpName value=[/ip hotspot user get $tmpI value-name=name];
:local tmpLimitTotal value=[/ip hotspot user get $tmpI value-name=limit-bytes-total];
:local tmpIn value=[/ip hotspot user get $tmpI value-name=bytes-in];
:local tmpOut value=[/ip hotspot user get $tmpI value-name=bytes-out];
:local tmpRemaining value=($tmpLimitTotal - ($tmpIn + $tmpOut));
:local tmpMessage value=("User: ".$tmpName.", Limit Total: ".$tmpLimitTotal.", Used In: ".$tmpIn.", Used Out: ".$tmpOut.", Remaining Total:".$tmpRemaining);
:if ([/ip hotspot user get $tmpI value-name=disabled]) do={:set tmpMessage value=("USER DISABLED: ".$tmpMessage);};
:if ($tmpRemaining < 1) do={:set tmpMessage value=("USER OUT OF BYTES: ".$tmpMessage);};
:log info message=$tmpMessage;
}

Is possible to write output to text file, each 100 users, using different file names.
Is not possible to store, on each file, more than 4096 Characters.

If I helped you, please add Karma.


thanx alot
1- how to wright this txt file? i got only the last user details?
2- i'v asked many times but no answer : can i send any kind of msg (or send txtfile over wifi) to my users when they r online and make it appear on their (mobiles-pc-laptops)

Re: reading hotspot users details

Posted: Sat Apr 12, 2014 6:34 pm
by obadaabdullah
any new help??