Community discussions

MikroTik App
 
Beko0ol
just joined
Topic Author
Posts: 18
Joined: Fri Jan 11, 2013 7:55 pm

Scripting Sum Count of bytes Out

Thu Sep 25, 2014 11:00 am

what's wrong with this script
:local gigabyte
:local name
:foreach name in=[/ip hotspot user find ] 
             do={:set gigabyte[$gigabyte+ /ip hotspot user get $name bytes-out] }
:put $gigabyte
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 558
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Scripting Sum Count of bytes Out

Thu Sep 25, 2014 8:55 pm

check this, may be is the solution for you

ros code

global gigabyte
:foreach name in=[/ip hotspot user find ] do={
global byte [/ip hotspot user get $name bytes-out]
:set gigabyte [($gigabyte + $byte)] 
:put $gigabyte
nothing
 
psamsig
Member Candidate
Member Candidate
Posts: 161
Joined: Sun Dec 06, 2009 1:36 pm
Location: Denmark

Re: Scripting Sum Count of bytes Out

Thu Sep 25, 2014 9:17 pm

/ip hotspot user {
    :local gigabyte 0
    :foreach i in=[find] do={
        :set gigabyte ($gigabyte + [get $i bytes-out])
    }
    :put $gigabyte
}
Last edited by psamsig on Fri Sep 26, 2014 12:14 pm, edited 1 time in total.
 
Beko0ol
just joined
Topic Author
Posts: 18
Joined: Fri Jan 11, 2013 7:55 pm

Re: Scripting Sum Count of bytes Out

Fri Sep 26, 2014 11:46 am

Thanks i used this and work fine

ros code

:global gigabyte 0 ;
:global byte 0 ; 
:foreach name in=[/ip hotspot user find ]
do={:set byte [/ip hotspot user get $name bytes-out];:set gigabyte [($gigabyte + $byte)] };
:put $gigabyte
Thank you for quick respond and attention.

Who is online

Users browsing this forum: No registered users and 15 guests