local address to netwatch host
Posted: Mon Jun 28, 2021 1:43 pm
pls help i need a script to get the local address in interface pppoe status and put it on netwatch host.
:put [/ip address get [find where interface=pppoe-out1] address]
/tool netwatch
add comment=pppoe-out1 down-script=":local ipx [/ip address get [find where interface=pppoe-out1] address]\r\
\n:local ip [:pick \$ipx -1 [:find \$ipx \"/\" -1]]\r\
\n/tool netwatch\r\
\n:local idwatch [find where comment=pppoe-out1]\r\
\n:if (\$ip != [get \$idwatch host]) do={\r\
\n set \$idwatch host=\$ip\r\
\n}\r\
\n" host=1.1.1.1 up-script=":local ipx [/ip address get [find where interface=pppoe-out1] address]\r\
\n:local ip [:pick \$ipx -1 [:find \$ipx \"/\" -1]]\r\
\n/tool netwatch\r\
\n:local idwatch [find where comment=pppoe-out1]\r\
\n:if (\$ip != [get \$idwatch host]) do={\r\
\n set \$idwatch host=\$ip\r\
\n}\r\
\n"