by DHCP-CLIENT lease found rogue DHCP-SERVER

Hi folks,
I’m solving a dhcp-lease script where a message is sent via whatsapp in case a dhcp rogue server appears on one of the VLAN branches. Where can be the error? The script is not running in this form :frowning: Please help…

I need in case of a rogue dhcp server the interface to detect the dhcp server and send the rights to the external service (in this case whatsapp).

The MAC address of the DHCP Server is important in this case to identify the port on the internal network and disable it.

:if ($bound=1) do={
:local tel "+420728XXXXXX"
:local apikey "XXXXXXXX"
:local iface $interface
:local gw [ /ip dhcp-client get [ find interface=$"iface" ] gateway ]
:local MAC [/ip arp get [/ip arp find address=$IP] mac-address]
/tool fetch http-method=get mode=https url="https://api.callmebot.com/whatsapp.php?phone=\$tel apikey=\$apikey text=\"Na rozhrani \$interface se objevil Rougue DHCP-SERVER s IP:\$IP a MAC:\$MAC";
/log warning "https://api.callmebot.com/whatsapp.php?phone=\$tel apikey=\$apikey text=\"Na rozhrani \$interface se objevil Rougue DHCP-SERVER s IP:\$IP a MAC:\$MAC";
}

You sure about these double quotes?

interface=$“iface”

I wasn’t sure about anything :smiley: Anyway, I found that at the time of assigning the dhcp client, the arp entry is not yet registered and so you can’t read the MAC right away. There is some sort of delay. This needs to be handled by some subsequent delay script that is called. I just need to figure out how to get the MAC from the arp against the IP address when the address is dynamic.

But this script already works for me:

:if ($bound=1) do={
:local tel "420XXXXXXXXX"
:local apikey XXXXXX
:local iface $interface
:local gw [ /ip dhcp-client get [ find interface=$iface ] gateway ]
/tool fetch http-method=get mode=https url="https://api.callmebot.com/whatsapp.php?phone=$tel&apikey=$apikey&text=Na+rozhrani+$interface+se+objevi+Rougue+DHCP-SERVER+s+IP:$gw";
}

Yep, but I meant that at first sight this:
interface=$“iface”
seems like a typo for the (probably) intended:
interface=“$iface”
or maybe:
interface=$iface
Only a doubt. :confused: