Script to check Port Speed "Rate"

When a switch can’t maintain 100mbps it drops a port to 10mbps.
I’m trying to do a script that can email me if a Port is at 10mbps.

The “Speed” shows what’s configured when “Auto-Negotiate” is disabled
The “Rate” shows what the Port is currently operating at.

“Rate” is shown on winbox screen, but not from cli in the Value-List, and I cannot figure out how to script it.

Thanks for any help!

use this :

/interface ethernet monitor <interface>

here is sapmle output:

[admin@hs] > interface ethernet monitor ether1 
            status: link-ok
  auto-negotiation: done
              rate: 1Gbps
       full-duplex: yes
          phy-regs: ...

Thanks for the reply.
My lack of scripting experience is now my problem-
I started with a simple script to check a single interface and create a log entry if true, but it doesn’t work.


/int eth monitor ether2 once do={
:if ($“rate” = “10Mbps”)
:log info “Ether2 is 10Mbps”
}

It doesn’t execute from the Winbox screen, but from the Terminal, it brings up 'do: ’ prompt, and execute correctly if I press enter.

Thanks!

Nevermind- I figured it out…

What did you figure out? Looking to do something similar. Thanks

Just some examples:

/interface ethernet monitor ether2 once do={
 :if ($"status" != "link-ok") do={ :log info "ether2 is WITHOUT LINK"};
 :if ($"auto-negotiation" != "done") do={ :log info "ether2 auto-negotiation NOT WORKING"};
 :if ($"rate" != "100Mbps") do={ :log info "ether2 is NOT 100Mbps"};
 :if ($"full-duplex" = "no") do={ :log info "ether2 is NOT Full-Duplex"};
}

Thanks …
This is useful and good …