Community discussions

MikroTik App
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

total download for hotspot users

Sat Jan 29, 2011 5:37 pm

I have Mikrotik RouterOS v4,16.
I ise the fallowing code to calculate the total download for the hotspot users, but there is errors:
:local bytesin 0;
:local bytesout 0;
/ip hotspot user {
   :foreach u in=[find] do={
      :set bytesin ($bytesin + [get $u bytes-in]);
      :set bytesout ($bytesout + [get $u bytes-out]);
   }
}
:set bytesin ($bytesin / (1024 * 1024 * 1024));
:set bytesout ($bytesout / (1024 * 1024 * 1024));
:put ("Bytes-In(GB): " . $bytesin);
:put ("Bytes-Out(GB): " . $bytesout);
where is wrong about it
 
multipath
newbie
Posts: 43
Joined: Fri Sep 17, 2010 4:42 pm

Re: total download for hotspot users

Sun Jan 30, 2011 12:57 pm

Study this link very well:

http://wiki.mikrotik.com/wiki/Manual:Scripting

Don't forget to set the variable "u" to 0 or nothing on script load as "u" is still considered a variable. Also start and stop the script with a { and } encapsulating the script. It will make debugging in the terminal window much easier.
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: total download for hotspot users

Mon Jan 31, 2011 1:21 pm

I change :local to :global and now it is working in the new terminal

Who is online

Users browsing this forum: No registered users and 2 guests