I haveMikrotik routerOs v4.11 with hotspot users accounts and I want to know if there is a way to calclate the sum of “Byte out” fol all users. Or I have to sum them manually.
at least print them in text file and I can paste that in excel to sum them
You could potentially use the API to grab that information and then program it to add all of that information for you. It should only grab what is currently in the host list of users in the host list if you use the right commands.
Another option would be to write a script that will get those totals and do the math on them from there.
Other than that, you are stuck doing it the manual way.
the interface only show you the bit rate. from hotspot–> users, I can see how many bytes each user has download or upload this month so far. I want the sum of this.
it would have been nice if there is option to copy in Winbox and paste somewhere else such as excel program.
namo,
I tried this on a v4.8 with no issues. I’ll try 4.11 later today with the same script.
UPDATE: Same script in v4.11 works with no issues as well.
I’m not sure why you’re getting expected variable name as the variables are defined at line 1 and line 2.
Syntax is correct on the last two lines as well.
Are you sure you included this at the top of the script?
Does Mikrotik can only have intergers? because the division results seems to be integers division with no decimal. which mean the result are rounded down
RouterOS scripting language has following data types:
Type Description
number - 64bit signed integer, possible hexadecimal input;
boolean - values can bee true or false;
string - character sequence;
IP - IP address;
internal ID - hexadecimal value prefixed by ‘*’ sign. Each menu item has assigned unique number - internal ID;
time - date and time value;
array - sequence of values organized in an array;
nil - default variable type if no value is assigned;
You could improve on that slight, I guess, by only dividing by (1024 * 1024) to get MB and then fudge and get a not-truly-GB number by just inserting a comma (or dot, whatever your decimal separator is) three characters from the right.
And if you really need decimal calculations, check out this math script I wrote a while back:
It actually allows you to calculate with decimals, and/or output decimals.