Community discussions

MikroTik App
 
gramels
just joined
Topic Author
Posts: 17
Joined: Thu Aug 14, 2014 11:28 am

capsman registration details

Mon Mar 13, 2017 8:26 am

Hi,

I tried to draft a script which shows the details of the CAPSman registered devices, basically
/caps-man registration-table print
enriched with DHCP active-name
/caps-man registration-table print detail
/ip dhcp-server lease print where mac-address=$MAC
in one list per item.
I seem to lack basic scripting skills to get this performed. Any hints?

-gramels
 
internethero
just joined
Posts: 4
Joined: Fri Mar 10, 2017 9:13 pm

Re: capsman registration details

Tue Mar 14, 2017 3:15 pm

To loop over the registration table and retrieve clients mac-address and ip-address from dhcp server

:foreach i in=[/caps-man registration-table find] do={
:local mac [/caps-man registration-table get $i mac-address]
:local ip [/ip dhcp-server lease get [/ip dhcp-server lease find where mac-address="$mac"] address]
:put "$mac - $ip"
}

Try to play arround in the console and see what output you get from different commands.
"find" for example returns the id for all the clients in the registration table using that id you can then retrieve the mac-address for that client.
If you type "/caps-man registration-table find" in to the console nothing will happen but if you type :put [/caps-man registration-table find] you will get all the id's.

Check the wiki, its a great resource while learning mikrotik scripting
https://wiki.mikrotik.com/wiki/Manual:Scripting
 
gustavomam
Trainer
Trainer
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Re: capsman registration details

Tue Apr 18, 2017 8:12 pm

HI gramels

I made this script on weekend, check my post.

viewtopic.php?f=9&t=120818

Who is online

Users browsing this forum: No registered users and 72 guests