Community discussions

MikroTik App
 
pamribeirox
just joined
Topic Author
Posts: 18
Joined: Fri Dec 22, 2017 6:20 pm

How to obtain inventory/usage of SFP modules?

Thu Oct 11, 2018 8:38 pm

Is there any simple way to obtain the SFP data (serial numbers and DDM info) for all the SFP modules installed in one equipment?
A complex script iterating thru all the SFP interfaces doesn't seem practical.
Some print command (eg. /interface ethernet sfp print ) should print a summary about each SFP/SFP+ interface model installed in each interface.

To obtain all the serial numbers and DDM info (ex. optical powers and wavelength) the /interface ethernet monitor should allow some filtering like:

Code: Select all

/interface ethernet monitor [find sfp-module-present=yes] once
This doesn't work at present ...
 
afuchs
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Wed Jul 03, 2019 11:10 am

Re: How to obtain inventory/usage of SFP modules?

Mon Sep 21, 2020 2:59 pm

Hello,

I know my answer will be a little late, but I only had a similar problem just now.
I used the following script to read out all ethernet interfaces, it can certainly be improved, but it's a start point.
:foreach i in=([/interface ethernet find ]) do={
    :local iterfacename [/interface ethernet get $i default-name ] 
    /interface ethernet monitor $iterfacename once without-paging
}
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: How to obtain inventory/usage of SFP modules?

Mon Sep 21, 2020 3:26 pm

Showing only the interfaces where the default names contain "sfp":
:foreach i in=([/interface ethernet find default-name~"sfp" ]) do={
    :local iterfacename [/interface ethernet get $i default-name ] 
    :/interface ethernet monitor $iterfacename once without-paging
}
And a bit shorter by skipping the usage of a variable and setting the path:
/interface ethernet; :foreach i in=([find default-name~"sfp"]) do={monitor [get $i default-name] once without-paging}
 
sebus
Frequent Visitor
Frequent Visitor
Posts: 67
Joined: Sun Mar 12, 2017 6:29 pm

Re: How to obtain inventory/usage of SFP modules?

Wed Apr 27, 2022 8:44 pm

Thanks, that's really handy!

Who is online

Users browsing this forum: Bing [Bot], coreshock, johnson73, StephenDig and 79 guests