What I need is the get the client name from the DHCP table fro each devices in the Wifi registration table.
Only first device gets listed, then scripts stops with "no such item"
I now all (just two for test) has DHCP hostname and both should be listed.
Any idea on what has gone wrong?
Code: Select all
{
:local hostName
/interface wireless registration-table
:foreach i in=[find] do={
:put ".id=$i;ap=$([get $i ap]);interface=$([get $i interface]);mac-address=$([get $i mac-address]);signal-strength=$([get $i signal-strength]);tx-rate=$([get $i tx-rate]);uptime=$([get $i uptime]);script=wifi;$([/ip dhcp-server lease get [find where mac-address=[get $i mac-address]] host-name ])"
}
}
:put [find]
give
*2;*3 so two devices.
This works fine for *2
:put [/ip dhcp-server lease get [find where mac-address=[get *2 mac-address]] ]
gives all DHCP including host-name
But for *3 it fails:
giving no such item
But both
:put [get *2 mac-address]
and
:put [get *3 mac-address]
works fine
Also using the mac directly works fine for both:
:put [/ip dhcp-server lease get [find where mac-address=4A:2F:D7:B1:03:xx] host-name]
RuterOS 7.12.1 on TB751UI