Community discussions

MikroTik App
 
mip
Member Candidate
Member Candidate
Topic Author
Posts: 124
Joined: Fri Jun 04, 2004 8:19 pm
Location: Ráckeve
Contact:

Count connected user, and do some actions in some cases

Sun Aug 14, 2005 12:32 am

I need a help.
I need a script that counts connected users on a specified interface and if it is zero than do an action (disable and enable the interface).
Not so difficult, but I'm close to give it up.
During my fight to make it I ask you to help.
If anyone have time, ability, please help.

Thanks

Peter
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: Count connected user, and do some actions in some cases

Sun Aug 14, 2005 1:40 am

counts connected users on a specified interface
What do you mean by connected users? hotspot users, tcp connections, entries in the arp table? If you can define what you want to monitor specifically I can probably help.

Sam
 
mip
Member Candidate
Member Candidate
Topic Author
Posts: 124
Joined: Fri Jun 04, 2004 8:19 pm
Location: Ráckeve
Contact:

Re: Count connected user, and do some actions in some cases

Sun Aug 14, 2005 9:58 am

counts connected users on a specified interface
What do you mean by connected users? hotspot users, tcp connections, entries in the arp table? If you can define what you want to monitor specifically I can probably help.

Sam
Sorry. Its a wireless interface (ap mode), and wireless clients.
 
mip
Member Candidate
Member Candidate
Topic Author
Posts: 124
Joined: Fri Jun 04, 2004 8:19 pm
Location: Ráckeve
Contact:

Sun Aug 14, 2005 11:45 pm

I did it. Seems to be good.

Here it is:

:global u
/interface wireless monitor wlan1 once do={
:set u $registered-clients
}
:if ($u = "0") do={
:log message="5213 interface error,
disabled"
/interface wireless dis wlan1
:log message="5213 interface restart"
/interface wireless en wlan1
}

My ap drops all clients and noone can reconnect until disable/enable interface. So I have to monitor number of clients, and if the ap is empty, restart the interface.
The problem exists under 2.8.19 or older versions with ath 5213 chip 2,4GHz. Hope it can be usefull for others too.

Who is online

Users browsing this forum: newtoptan and 12 guests