Skip to content

Instantly share code, notes, and snippets.

@jmcarbo
Created May 2, 2018 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmcarbo/3ca7e22179efcbedd1618e8d2cbaad86 to your computer and use it in GitHub Desktop.
Save jmcarbo/3ca7e22179efcbedd1618e8d2cbaad86 to your computer and use it in GitHub Desktop.
/ip dhcp-server lease {
:foreach i in=[find (dynamic && status="bound" && server="rang172-20-4")] do={
:local activeAddress [get $i active-address]
:local activeMacAddress [get $i active-mac-address]
:local hostname ""
:local hostname [get $i host-name]
:if ( [:len $hostname] > 0) do={ :put "OK $[:len $hostname] *$hostname*"; [/ip dhcp-server lease make-static $i]; }
:put ($outputContent . "\n" . $activeAddress . "," . $activeMacAddress . "," . $hostname)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment