I’ve got the latest RouterOS v6.28. And I want to make some scripts to manage DHCP records externally.
I tried to do it in CLI first:
[admin@] > /ip dhcp-server lease print
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
0 10.0.0.1 11:11:11:11:11:11 waiting
1 10.0.0.2 22:22:22:22:22:22 waiting
[admin@] > /ip dhcp-server lease find mac-address=11:11:11:11:11:11
[admin@] > /ip dhcp-server lease find ?
Returns list of items which property values are equal to given ones. Returns list of all items if no arguments are given.
<where> --
[admin@] > /ip dhcp-server lease find
Why is there no any output from find commands?
Then I tried to use PHP API:
$dhcpRequest = new RouterOS\Request('/ip dhcp-server lease find');
$results = $client->sendSync(
$dhcpRequest
);
print_r($results);
[ret] => *1;*2
$dhcpRequest = new RouterOS\Request('/ip dhcp-server lease find');
$results = $client->sendSync(
$dhcpRequest->setArgument('mac-address','11:11:11:11:11:11')
);
print_r($results);
[message] => unknown parameter
What am I doing wrong? Please help me. Is there any more detailed documentation? I’ve read wiki and some PDF, but there is no detailed info on find syntax. I can’t figure out how it works.