Community discussions

MikroTik App
 
pkisistemas2
just joined
Topic Author
Posts: 15
Joined: Wed May 04, 2011 10:25 pm

How can i count users??

Thu Mar 15, 2012 10:22 pm

What i want... easy, count the number of users in one hotspot, so when dhcp asssign a ip to one user, add one line to a file with data and hour..., so, counting lines i can count the number os users.

Sure, there will be better ways to do the same... (i have tried to save dhcp logs... but they are too longs for this use)... i have searched the forum looking for something similar, but nothing...if someone can help me i will be grateful.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: How can i count users??

Thu Mar 15, 2012 11:50 pm

{
:local usuarios [:len [ip dhcp-server lease find ]]
:local timesys [system clock get time]
:local datesys [system clock get date ]
:log error "the number of user is $usuarios, the time is $timesys, the date is $datesys "
}
Last edited by c0d3rSh3ll on Fri Mar 16, 2012 5:48 pm, edited 1 time in total.
 
angboontiong
Forum Guru
Forum Guru
Posts: 1136
Joined: Fri Jan 16, 2009 9:59 am

Re: How can i count users??

Fri Mar 16, 2012 12:27 pm

i use the scheduler to tell me time to time...

/tool e-mail send server=xx.xx.xx.xx to=receiver@xxx.com from=system_name subject="$[/system identity get name] $[/system clock get time] $[/system clock get date]" body="The total user online at this moment is [$[/ip hotspot active print count]]"

remarks: xx.xx.xx.xx is the mail server ip.
 
pkisistemas2
just joined
Topic Author
Posts: 15
Joined: Wed May 04, 2011 10:25 pm

Re: How can i count users??

Fri Mar 16, 2012 7:47 pm

I have thinking in that option... but you only see user in one moment... with dchp leases i can see users in one day (for example)... many of actual users of hotspot are android an iphone users (10 minutes use... and close the conection... i need to count this users too), so best solution is copy leases of dhcp at end of day to a file.... but i dont know how to make it... and specially how to append in the same file from day to day...

Who is online

Users browsing this forum: WarlorZ and 10 guests