Community discussions

MikroTik App
 
Zaesch
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Apr 16, 2009 12:43 pm

Show all interfaces and SFP transceiver information

Thu Aug 18, 2022 3:54 pm

Hey,

is there a way to show all interfaces and their SFP transceiver information at once via cli?
For example like "show interface status" on Cisco devices. Something like:
sfp-sfpplus1 --> S-RJ01
sfp-sfpplus2 --> S-85DLC05D
and so on

Greetings!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12003
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Show all interfaces and SFP transceiver information

Thu Aug 18, 2022 4:04 pm

You mean "Show all SFP interfaces and, if present, the module information"?
/interface ethernet
{
    :local iflist [find where default-name~"(sfp|combo)"]
    :foreach if in=$iflist do={
        :local ifname     [get $if name]
        :local nicename   [:pick "$ifname          " 0 13]
        :local ifmon      [monitor $ifname once as-value]
        :local sfppresent ($ifmon->"sfp-module-present")
        :local sfpmodel   ($ifmon->"sfp-vendor-part-number")
        :if ($sfppresent = true) do={:put "$nicename --> $sfpmodel"} else={:put "$nicename --> <empty>" }
    }
}
 
Zaesch
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Apr 16, 2009 12:43 pm

Re: Show all interfaces and SFP transceiver information

Thu Aug 18, 2022 4:41 pm

I had a simple command in mind :wink: , but that script will do it also 8)
Thanks!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12003
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Show all interfaces and SFP transceiver information

Thu Aug 18, 2022 4:42 pm

modified previous script for include combo sfp/ether and align names

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], sakistech and 93 guests