Hello
I need to get information about sfp-tx-power and sfp-rx-power and put this in scritpt to send email and sms.
I need help, same basic script to get information from SFP module.
/interface ethernet monitor sfp1
Output:
# aug/24/2017 21:19:35 by RouterOS 6.40.1
#
#
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: 47C
sfp-supply-voltage: 3.311V
sfp-tx-bias-current: 6mA
sfp-tx-power: -6.942dBm
sfp-rx-power: -18.987dBm
eeprom-checksum: good
This works ok, but i need only TX and RX power on SFP modules and set it to global value and next use in other scripts.
Thanks for Help
Marcin
Well, you can simple use variables
:global monitor [/interface ethernet monitor sfp1 once as-value]
:put ($monitor->valuewhatyouwant)
Hello
Not work, return:
.id=*7;advertising=;auto-negotiation=done;comment=;eeprom=0000: 03 04 07 00 00 00 02 12 00 01 01 01 0d 00 0a 64 ........ .......d
0010: 37 37 00 00 53 75 6d 69 74 6f 6d 6f 45 6c 65 63 77..Sumi tomoElec
0020: 74 72 69 63 00 00 00 5f 53 43 50 36 47 34 34 2d tric..._ SCP6G44-
0030: 48 32 2d 42 57 45 20 20 41 20 20 20 05 1e 00 76 H2-BWE A ...v
0040: 00 1a 00 00 30 31 54 34 30 36 36 30 37 33 36 39 ....01T4 06607369
0050: 20 20 20 20 31 30 30 31 31 32 20 20 58 f0 01 d6 1001 12 X...
0060: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0070: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0080: 69 00 d3 00 5f 00 d3 00 9c 40 6d 60 8c a0 75 30 i..._... .@m`..u0
0090: 75 30 00 00 61 a8 00 00 27 10 02 76 13 93 04 ea u0..a... '..v....
00a0: 13 94 00 7e 13 94 00 7e 00 00 00 00 00 00 00 00 ...~...~ ........
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00c0: 00 00 00 00 3f 80 00 00 00 00 00 00 01 00 00 00 ....?... ........
00d0: 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 e6 ........ ........
00e0: 30 32 81 ce 0a ff 07 e6 07 31 00 00 00 00 00 00 02...... .1......
00f0: 00 40 00 00 00 40 00 00 00 00 00 00 00 00 00 00 .@...@.. ........;eeprom-checksum=good;full-duplex=true;link-partner-advertising=;name=sfp1;rate=1Gbps;rx-flow-control=false;sfp-connector-type=LC;sfp-link-length-50um=550;sfp-link-length-62um=550;sfp-link-length-9um=10000;sfp-manufacturing-date=10-01-12;sfp-module-present=true;sfp-rx-loss=false;sfp-rx-power=-8615;sfp-supply-voltage=3323;sfp-temperature=48;sfp-tx-bias-current=5;sfp-tx-power=-6942;sfp-type=SFP-or-SFP+;sfp-vendor-name=SumitomoElectric;sfp-vendor-part-number=SCP6G44-H2-BWE;sfp-vendor-revision=A;sfp-vendor-serial=01T406607369;sfp-wavelength=131000;status=link-ok;tx-flow-control=false
Other solution:
I can save a dump to a file, but how do I read a selected data (sfp-tx-power and sfp-rx-power) from a file and send it to value?
As i wrote use variables and print specific key.
:global monitor [/interface ethernet monitor sfp1 once as-value]
:put ($monitor->"sfp-tx-power")
:put ($monitor->"sfp-rx-power")
I think mikrotik dont support this, just use my solution and write it to /tool sms script or other script, if you are interested to scripting i recommend mikrotik wiki
Your solution displays too much unnecessary information. For me not work. I don’t believe that Mikrotik can’t do that…
This Script working OK.
:global monitorsfprx [/interface ethernet monitor sfp1 once as-value]
:global monitorsfprx [:put ($monitorsfprx->"sfp-rx-power")]
and
:global monitorsfptx [/interface ethernet monitor sfp1 once as-value]
:global monitorsfptx [:put ($monitorsfprx->"sfp-tx-power")]
Thanks
Tec
August 17, 2020, 5:11pm
10
Hi,
Is there a way to monitor the SFP modules temperature via such a command line on a crs309 in router mode ?
works ok ros 6.48.3 on CRS317
Thank You
Steveocee:
This Script working OK.
:global monitorsfprx [/interface ethernet monitor sfp1 once as-value]
:global monitorsfprx [:put ($monitorsfprx->"sfp-rx-power")]
and
:global monitorsfptx [/interface ethernet monitor sfp1 once as-value]
:global monitorsfptx [:put ($monitorsfprx->"sfp-tx-power")]
Thanks
works ok ros 6.48.3 on CRS317
Thank You
:put is for interactive terminal,
use :put inside any type of script is an idiocy error.
:global monitorsfptx ([/interface ethernet monitor sfp1 once as-value]->"sfp-tx-power")
:global monitorsfprx ([/interface ethernet monitor sfp1 once as-value]->"sfp-rx-power")
# but this is better: prevent error when sfp1 is not connected or SFP models that not support read power are used
:global monitorsfp1 [/interface ethernet monitor sfp1 once as-value]
:global monitorsfp1tx ([:tonum ($monitorsfp1->"sfp-tx-power")]+0)
:global monitorsfp1rx ([:tonum ($monitorsfp1->"sfp-rx-power")]+0)