flags

[admin@MikroTik] /interface ethernet> monitor ether3
status: link-ok
auto-negotiation: done
rate: 100Mbps
full-duplex: yes

[admin@MikroTik] /interface ethernet> monitor ether3
status: no-link
auto-negotiation: done
rate: 100Mbps
full-duplex: yes
an example of how to detect the “status:” in a script would be appreciated

See ya at the Dallas MUM if your there!
thanks

:local myStatus "";
/inerface ethernet monitor ether2  once do={ :set myStatus $status }
:put "last status was $myStatus";

just what i needed to get started

thank you very much!

I am new to scripting so please be patient with me.
after a few hours or so this is as close as I got to making this work fixing the typo in the word “internet” and changing the curly brackets to just plain parentheses

[jeff@MikroTik] > :local myStatus “”;
[jeff@MikroTik] > /interface ethernet monitor ether2 once do=( :set myStatus $status ) ;
status: no-link
auto-negotiation: done
rate: 10Mbps
full-duplex: no
[jeff@MikroTik] > :put “last status was $myStatus”;
expected end of command (line 1 column 23)
[jeff@MikroTik] >


i also tried this as the last line

[jeff@MikroTik] > :put “last status was $(myStatus)”;
last status was
[jeff@MikroTik] >

i was exspecting it to return last status was no-link

im using ros3.20 if that makes a difference.
thanks

in console each lien is treated like separate script, but local variables are available only within the current scope.
If you paste this script directly into console you have two options:
*) replace :local with :global or
*) put all script inside braces {}

thank you for the quick reply and the excellent explanation