Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 22537

Scripting • Re: RoS 7.15 broke a DHCP script

$
0
0
Try to use this:
Code:
#-----------------works----------------:if ($leaseBound =1) do={  local result ([/tool fetch url=("https://api.macvendors.com/".$leaseActMAC) output=user as-value ])  if ($result->"status" = "finished") do={    local comment0 ([/system clock get date]." | ".[/system clock get time]." | "."MAC Vendor: ".$result->"data")    ip dhcp-server lease set [find mac-address=$leaseActMAC dynamic=yes] comment=$comment0 /tool e-mail send to=your@mail.com  subject="DHCP-List-LAN" body="$leaseActIP - $"lease-hostname" - $leaseActMAC - $comment0"    }}
if you don't need send it to email, remove the whole line 7.

ideal save it as script, like dhcp-lan-lease-script and put it in
Code:
ip/dhcp-server/add lease-script=dhcp-lan-lease-script
permissions for the script must be ftp,reboot,read,write,policy,test,password,sniff,sensitive

Statistics: Posted by makrob — Mon Jun 03, 2024 11:16 pm



Viewing all articles
Browse latest Browse all 22537

Trending Articles