I do not get the desired result from my script so have done some testing.
It seems that the variables files when there are two - (minus) in the string.
This is from my DHCP server with name “DHCP-Pool-vlan1-Home”
I would like to get the number of leases in the DHCP server, but it seems to feil due to the pool name
Running this from cli, I should get 95 for all test.
/ip pool =/= Server under dhcp-server lease (You keep using “/ip dhcp-server lease find where server” in Your script - clarify on what exactly You are changing: dhcp-server name or /ip pool name)
Keep 1 line empty above [ code ] block so it formats properly (I keep formating Your posts recently just so it properly formats into a nice code-box).
Since this is a part of the pool script does does not list static list, it’s start under /ip pool
But I should be able to use /ip dhcp-server lease even in /ip pool as long as I do use full url.
Does not work
ip dhcp-server> /ip dhcp-server lease print where server~"gu"
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
NB running 6.43.4
more test
[admin@r1] /ip dhcp-server> lease print where server~"gu"
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
[admin@r1] /ip dhcp-server> lease print where server~"est"
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
0 ;;; jun/01/2019 13:08:56
10.10.20.191 00:1D:EC:06:1D:F5 DHCP-vlan... bound
1 ;;; jun/01/2019 13:12:51
10.10.20.190 E4:A4:71:04:7F:8B HE16 DHCP-vlan... waiting
2 ;;; jun/07/2019 17:44:56