opticsmon - Collect diagnostics data from optical modules
![]()
Use the opticsmon command in scripts or integrated with other monitoring solutions. This command can be used in both DPM and PR/SM environments.
Running opticsmon without arguments queries the current state of all supported optical modules. The output is given in JSON format.
For problem analysis, run opticsmon to extract raw module data. The data follows the small form factor (SFF) 8636/8472/8024 standards. You can obtain the same data in human-readable format with the command
# ethtool --module-info <netdev>
where:
- -m or --monitor
- runs continuously and periodically reports on link state changes.
- -r or --send-report
- sends module data directly to the firmware for further processing, automatic problem detection, and potentially call home.
- -q or --quiet
- runs quietly and does not print optics health summary.
- -i or --interval <seconds>
- specifies the interval in seconds in which to collect monitoring data in the absence of link state changes. A value larger than 24 hours (86400 seconds) is reduced to 24 hours.
- --module-info
- includes a base-64 encoded binary dump of the module's SFF-8636/8472/8024 standard data for each netdev. This matches
ethtool --module-info <netdev> raw on. - -h or --help
- displays help information for the command.
- -v or --version
- displays the version of the command, then exits.
Example: Extract raw module data in hex
The following pipeline uses jq, base64, and hexdump to produce the raw module EEPROM data for all supported network modules in a human‑readable hexadecimal layout. This is similar to ethtool --module-info <netdev> hex on, but operates on the JSON emitted by opticsmon. Use jq -r (raw output) to emit the base64 data without quotes.
opticsmon --module-info \
| jq -r '.adapters[0].netdevs[0].optics.module_info' \
| base64 -d \
| hexdump -C
where
jq -rfilters the JSON to select the base64‑encoded raw module data fields, without surrounding quotes.base64 -d(or --decode) transforms the base64 data from jq back into binary format.hexdump -Crenders the binary stream as canonical hex + ASCII view, showing offsets, hex pairs, and printable characters.