Take sfp information from a mikrotik device

Hello
How can I get information about sfp-tx-power and sfp-rx-power from a Mikrotik device and put this in some LibreNMS entity and then create an alert rule?

name: sfp1
status: link-ok
auto-negotiation: done
rate: 1Gbps
full-duplex: yes
tx-flow-control: no
rx-flow-control: no
advertising:
link-partner-advertising:
sfp-module-present: yes
sfp-rx-loss: no
sfp-type: SFP-or-SFP+
sfp-connector-type: LC
sfp-link-length-9um: 10000m
sfp-link-length-50um: 550m
sfp-link-length-62um: 550m
sfp-vendor-name: SumitomoElectric
sfp-vendor-part-number: SCP6G44-H2-BWE
sfp-vendor-revision: A
sfp-vendor-serial: 01T4xxxxxxx
sfp-manufacturing-date: 10-01-12
sfp-wavelength: 1310nm
sfp-temperature: 37C
sfp-supply-voltage: 3.321V
sfp-tx-bias-current: 6mA
sfp-tx-power: -6.947dBm
sfp-rx-power: -12.987dBm

Assuming the device detects and you get the SFP basic information on the right hand panel?

Are you wanting to know when there is a link loss or just some degredation of the power? Link loss will be detected and can be alerted using this existing collection rule - it works on all the SFP interfaces on my Mikrotiks:


For example:

If the sensor has a limit defined and captured (there isn’t on my Mikrotiks it seems) these two existing rules from the collection will flag it - it’s more common for temperatures:

If you want to make your own limits, you can use the sensors_current information something like this to make a custom alert:

Hi Rhinoau, it has been very helpful, thank you very much in advance.

Now I have a new problem, the alert reports the correct value but at the same time it repeats it and shows in all the sfp-sfpplus interfaces, how can I make it only show the sensor_current value together with the sfpplus interface associated with it?
Do you know any solution ?

Captura de pantalla de 2021-06-25 15-41-16

Greetings

I just alert on interface state as I mentioned, but I made a test rule from the linked post and seems to work normally for me - this device has spf11 at -11.2 and it doesn’t alert:

image

I looked in the sensors table to see what exactly to use for the desc/class etc. It may also help to have an Rx and Tx rule separately.

For a test, if you you set sensors.sensor_current less or equal to something in the middle of your numbers such as -13.5 - does it get rid of the lower values after a few minutes?

May take someone who actual does this to compare to assist if still no good. Can you share the exact rule you’ve created?

Hi thanks . I share alert rule for this case.

Greetings

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.