Reading/Trending optical light levels

Problem/Question

ethtool can read optic light levels off of newer NICs (using I2C), can this be added to netData to trend? The Tx/Rx light levels of each channel as well as warning/alarm status are what I’m interested in seeing. Other optics might report frequency, BER (bit-error-rate) and possibly SNR. I’ll see if I can dig up an example.

[root@NODE ~]# ethtool -m ens1f1np1
	Identifier                                : 0x03 (SFP)
	Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
	Connector                                 : 0x07 (LC)
	Transceiver codes                         : 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
	Transceiver type                          : 10G Ethernet: 10G Base-LR
	Encoding                                  : 0x06 (64B/66B)
	BR, Nominal                               : 10300MBd
	Rate identifier                           : 0x00 (unspecified)
	Length (SMF,km)                           : 10km
	Length (SMF)                              : 10000m
	Length (50um)                             : 0m
	Length (62.5um)                           : 0m
	Length (Copper)                           : 0m
	Length (OM3)                              : 0m
	Laser wavelength                          : 1310nm
	Vendor name                               : JUNIPER-EQUIV
	Vendor OUI                                : 00:17:6a
	Vendor PN                                 : SFPP-10GE-LR-OSI
	Vendor rev                                : B4
	Option values                             : 0x00 0x1a
	Option                                    : RX_LOS implemented
	Option                                    : TX_FAULT implemented
	Option                                    : TX_DISABLE implemented
	BR margin, max                            : 0%
	BR margin, min                            : 0%
	Vendor SN                                 : REDACTED
	Date code                                 : 080702
	Optical diagnostics support               : Yes
	Laser bias current                        : 30.812 mA
	Laser output power                        : 0.6880 mW / -1.62 dBm
	Receiver signal average optical power     : 0.7022 mW / -1.54 dBm
	Module temperature                        : 39.18 degrees C / 102.53 degrees F
	Module voltage                            : 3.2158 V
	Alarm/warning flags implemented           : Yes
	Laser bias current high alarm             : Off
	Laser bias current low alarm              : Off
	Laser bias current high warning           : Off
	Laser bias current low warning            : Off
	Laser output power high alarm             : Off
	Laser output power low alarm              : Off
	Laser output power high warning           : Off
	Laser output power low warning            : Off
	Module temperature high alarm             : Off
	Module temperature low alarm              : Off
	Module temperature high warning           : Off
	Module temperature low warning            : Off
	Module voltage high alarm                 : Off
	Module voltage low alarm                  : Off
	Module voltage high warning               : Off
	Module voltage low warning                : Off
	Laser rx power high alarm                 : Off
	Laser rx power low alarm                  : Off
	Laser rx power high warning               : Off
	Laser rx power low warning                : Off
	Laser bias current high alarm threshold   : 90.000 mA
	Laser bias current low alarm threshold    : 2.000 mA
	Laser bias current high warning threshold : 80.000 mA
	Laser bias current low warning threshold  : 3.000 mA
	Laser output power high alarm threshold   : 1.7783 mW / 2.50 dBm
	Laser output power low alarm threshold    : 0.1995 mW / -7.00 dBm
	Laser output power high warning threshold : 1.4125 mW / 1.50 dBm
	Laser output power low warning threshold  : 0.2512 mW / -6.00 dBm
	Module temperature high alarm threshold   : 90.00 degrees C / 194.00 degrees F
	Module temperature low alarm threshold    : -25.00 degrees C / -13.00 degrees F
	Module temperature high warning threshold : 85.00 degrees C / 185.00 degrees F
	Module temperature low warning threshold  : -20.00 degrees C / -4.00 degrees F
	Module voltage high alarm threshold       : 3.6000 V
	Module voltage low alarm threshold        : 3.0000 V
	Module voltage high warning threshold     : 3.5000 V
	Module voltage low warning threshold      : 3.0500 V
	Laser rx power high alarm threshold       : 1.0000 mW / 0.00 dBm
	Laser rx power low alarm threshold        : 0.0158 mW / -18.01 dBm
	Laser rx power high warning threshold     : 0.7943 mW / -1.00 dBm
	Laser rx power low warning threshold      : 0.0200 mW / -16.99 dBm

[root@NODE ~]# ethtool -m ens1f1np0
netlink error: no device matches name (offset 24)
netlink error: No such device

[root@NODE ~]# ethtool -m ens3f0np0
	Identifier                                : 0x11 (QSFP28)
	Extended identifier                       : 0x8c
	Extended identifier description           : 2.5W max. Power consumption
	Extended identifier description           : CDR present in TX, CDR present in RX
	Extended identifier description           : High Power Class (> 3.5 W) not enabled
	Power set                                 : Off
	Power override                            : On
	Connector                                 : 0x0c (MPO Parallel Optic)
	Transceiver codes                         : 0x80 0x00 0x00 0x00 0x40 0x40 0x02 0x00
	Transceiver type                          : 100G Ethernet: 100G Base-SR4 or 25GBase-SR
	Transceiver type                          : FC: short distance (S)
	Transceiver type                          : FC: Shortwave laser w/o OFC (SN)
	Transceiver type                          : FC: Multimode, 50um (OM3)
	Encoding                                  : 0x07 ((256B/257B (transcoded FEC-enabled data))
	BR, Nominal                               : 25500Mbps
	Rate identifier                           : 0x00
	Length (SMF,km)                           : 0km
	Length (OM3 50um)                         : 70m
	Length (OM2 50um)                         : 0m
	Length (OM1 62.5um)                       : 0m
	Length (Copper or Active cable)           : 50m
	Transmitter technology                    : 0x00 (850 nm VCSEL)
	Laser wavelength                          : 850.000nm
	Laser wavelength tolerance                : 10.000nm
	Vendor name                               : Mellanox
	Vendor OUI                                : 8c:2f:a6
	Vendor PN                                 : QSFP28-100G-AOC3
	Vendor rev                                : 10
	Vendor SN                                 : REDACTED
	Date code                                 : 200515
	Revision Compliance                       : SFF-8636 Rev 2.5/2.6/2.7
	Module temperature                        : 54.46 degrees C / 130.03 degrees F
	Module voltage                            : 3.2580 V
	Alarm/warning flags implemented           : Yes
	Laser tx bias current (Channel 1)         : 7.800 mA
	Laser tx bias current (Channel 2)         : 7.800 mA
	Laser tx bias current (Channel 3)         : 7.800 mA
	Laser tx bias current (Channel 4)         : 7.800 mA
	Transmit avg optical power (Channel 1)    : 0.5186 mW / -2.85 dBm
	Transmit avg optical power (Channel 2)    : 0.5075 mW / -2.95 dBm
	Transmit avg optical power (Channel 3)    : 0.5186 mW / -2.85 dBm
	Transmit avg optical power (Channel 4)    : 0.5433 mW / -2.65 dBm
	Rcvr signal avg optical power(Channel 1)  : 1.0624 mW / 0.26 dBm
	Rcvr signal avg optical power(Channel 2)  : 1.0498 mW / 0.21 dBm
	Rcvr signal avg optical power(Channel 3)  : 1.0647 mW / 0.27 dBm
	Rcvr signal avg optical power(Channel 4)  : 1.0881 mW / 0.37 dBm
	Laser bias current high alarm   (Chan 1)  : Off
	Laser bias current low alarm    (Chan 1)  : Off
	Laser bias current high warning (Chan 1)  : Off
	Laser bias current low warning  (Chan 1)  : Off
	Laser bias current high alarm   (Chan 2)  : Off
	Laser bias current low alarm    (Chan 2)  : Off
	Laser bias current high warning (Chan 2)  : Off
	Laser bias current low warning  (Chan 2)  : Off
	Laser bias current high alarm   (Chan 3)  : Off
	Laser bias current low alarm    (Chan 3)  : Off
	Laser bias current high warning (Chan 3)  : Off
	Laser bias current low warning  (Chan 3)  : Off
	Laser bias current high alarm   (Chan 4)  : Off
	Laser bias current low alarm    (Chan 4)  : Off
	Laser bias current high warning (Chan 4)  : Off
	Laser bias current low warning  (Chan 4)  : Off
	Module temperature high alarm             : Off
	Module temperature low alarm              : Off
	Module temperature high warning           : Off
	Module temperature low warning            : Off
	Module voltage high alarm                 : Off
	Module voltage low alarm                  : Off
	Module voltage high warning               : Off
	Module voltage low warning                : Off
	Laser tx power high alarm   (Channel 1)   : Off
	Laser tx power low alarm    (Channel 1)   : Off
	Laser tx power high warning (Channel 1)   : Off
	Laser tx power low warning  (Channel 1)   : Off
	Laser tx power high alarm   (Channel 2)   : Off
	Laser tx power low alarm    (Channel 2)   : Off
	Laser tx power high warning (Channel 2)   : Off
	Laser tx power low warning  (Channel 2)   : Off
	Laser tx power high alarm   (Channel 3)   : Off
	Laser tx power low alarm    (Channel 3)   : Off
	Laser tx power high warning (Channel 3)   : Off
	Laser tx power low warning  (Channel 3)   : Off
	Laser tx power high alarm   (Channel 4)   : Off
	Laser tx power low alarm    (Channel 4)   : Off
	Laser tx power high warning (Channel 4)   : Off
	Laser tx power low warning  (Channel 4)   : Off
	Laser rx power high alarm   (Channel 1)   : Off
	Laser rx power low alarm    (Channel 1)   : Off
	Laser rx power high warning (Channel 1)   : Off
	Laser rx power low warning  (Channel 1)   : Off
	Laser rx power high alarm   (Channel 2)   : Off
	Laser rx power low alarm    (Channel 2)   : Off
	Laser rx power high warning (Channel 2)   : Off
	Laser rx power low warning  (Channel 2)   : Off
	Laser rx power high alarm   (Channel 3)   : Off
	Laser rx power low alarm    (Channel 3)   : Off
	Laser rx power high warning (Channel 3)   : Off
	Laser rx power low warning  (Channel 3)   : Off
	Laser rx power high alarm   (Channel 4)   : Off
	Laser rx power low alarm    (Channel 4)   : Off
	Laser rx power high warning (Channel 4)   : Off
	Laser rx power low warning  (Channel 4)   : Off
	Laser bias current high alarm threshold   : 14.000 mA
	Laser bias current low alarm threshold    : 2.000 mA
	Laser bias current high warning threshold : 13.000 mA
	Laser bias current low warning threshold  : 3.000 mA
	Laser output power high alarm threshold   : 2.1878 mW / 3.40 dBm
	Laser output power low alarm threshold    : 0.1148 mW / -9.40 dBm
	Laser output power high warning threshold : 1.7378 mW / 2.40 dBm
	Laser output power low warning threshold  : 0.1445 mW / -8.40 dBm
	Module temperature high alarm threshold   : 80.00 degrees C / 176.00 degrees F
	Module temperature low alarm threshold    : -10.00 degrees C / 14.00 degrees F
	Module temperature high warning threshold : 75.00 degrees C / 167.00 degrees F
	Module temperature low warning threshold  : 0.00 degrees C / 32.00 degrees F
	Module voltage high alarm threshold       : 3.6000 V
	Module voltage low alarm threshold        : 2.9000 V
	Module voltage high warning threshold     : 3.5000 V
	Module voltage low warning threshold      : 3.0000 V
	Laser rx power high alarm threshold       : 2.1878 mW / 3.40 dBm
	Laser rx power low alarm threshold        : 0.0794 mW / -11.00 dBm
	Laser rx power high warning threshold     : 1.7378 mW / 2.40 dBm
	Laser rx power low warning threshold      : 0.0871 mW / -10.60 dBm

Relevant docs you followed/actions you took to solve the issue

Environment/Browser/Agent’s version etc

What I expected to happen

Hey, @James_Harr. Consider creating a feature request.