Script to check port ethernet status

Hi all,

Sometimes my Rb1200 ports can’t maintain 100mbps and it drops a port to 10mbps.
I’m trying to do a script that disable and then enable this port when this situation occurs.

(because if I do manually this procedure it works and the port backs again to 100 mbps).

Then I need a script thats it checks the rate of the port every 10 mins, like example. (Ok: this I will be done with scheduler).

This is my script, BUT it doesnt work ! Maybe is a error code… I dont know.

Any help will be apreciatted.

/interface ethernet monitor ether1 once do={
:if ($rate = "10Mbps") do={
:/interface ethernet set ether1 disabled=yes
:delay 5s
:/interface ethernet set ether1 disabled=no
else={
:log info "status not changed"
}
}
}

how it works, and it does not make a lot of log entries

/interface ethernet monitor ether1 once do={
:if ($rate = "10Mbps") do={
/interface ethernet set ether1 disabled=yes
:delay 5s
/interface ethernet set ether1 disabled=no
:log info message="ether1 reset by script";
}
}