i made the following script :
Code: Select all
/tool netwatch
:for i from=31 to=225 do={
:local nhost "10.1.0.$i";
add host="$nhost" interval=1s timeout=100ms disabled=yes \
up-script="{:local nIP \$nhost;\r\n\
:local nDevice [/ip dns static get [find address=\$nIP] name];\r\n\
:log info \"### \$nDevice IP Address \$nIP UP ###\";}" \
down-script="{:local nIP \$nhost;\r\n\
:local nDevice [/ip dns static get [find address=\$nIP] name];\r\n\
:log info \"### \$nDevice IP Address \$nIP DOWN ###\";}"
}
the result on export like follow :
Code: Select all
/tool netwatch
add disabled=yes down-script=\
"{:local nIP \$nhost;\r\
\n:local nDevice [/ip dns static get [find address=\$nIP] name];\r\
\n:log info \"### \$nDevice IP Address \$nIP DOWN ###\";\r\
\n\
\n}" host=10.1.0.31 interval=1s timeout=100ms up-script=\
"{:local nIP \$nhost;\r\
\n:local nDevice [/ip dns static get [find address=\$nIP] name];\r\
\n:log info \"### \$nDevice IP Address \$nIP UP ###\";\r\
\n}"
the parameter host is replaced with the correct value of $nhost, but why both parameter $nhost on both UP and DOWN scripts does not replaced with the value declared ?
thank you
P