Mikrotik quickie: Add DHCP alert on DHCP relayed interface
DHCP alerting is a feature of RouterOS, which can alert us on rogue DHCP server on the network. The working principle is easy. Router sends DHCPDISCOVER packet on interface and if there’s reply by router not in whitelist, the incident is logged. This script may become handy during mass deployment of this feature. It adds a DHCP alert on interface running DHCP relay. Comes in handy if you need to deploy it on dozens of routers in one day.
:foreach i in=[/ip dhcp-relay find] do={ :local int [/ip dhcp-relay get $i interface] /ip dhcp-server alert add alert-timeout=01:00:00 interface=$int disabled=no }