Community discussions

MikroTik App
 
jagger85
just joined
Topic Author
Posts: 3
Joined: Tue Jul 17, 2018 7:38 pm

getting host-name from hotspot onlogin

Fri Sep 28, 2018 7:58 pm

hi there!
I'm trying to get the hostname from the user when loggin to my hotspot, the script is running in the onlogin propertie,
my approach :
:local pc;
:set pc [/ip dhcp-server lease get $"mac-address" host-name];
:log info "computer name:$pc"
any idea where can I be wrong..... :?
 
jagger85
just joined
Topic Author
Posts: 3
Joined: Tue Jul 17, 2018 7:38 pm

Re: getting host-name from hotspot onlogin  [SOLVED]

Mon Oct 01, 2018 7:17 pm

I found the solution, the right way is:
:local mac;
:local host;
:set mac $"mac-address";
:set host [ip/ dhcp-server lease get [ find mac-address=$mac ] host-name ];
:log info "the host-name is $host"
what I am wondering is why can't use $"mac-address" in first place instead of parsing it to another variable, anyway this works for me!

Who is online

Users browsing this forum: No registered users and 28 guests