Using the opticsmon service
As of IBM z17, you must use the opticsmon.service to collect optics data for physical function (PF) access mode devices, such as NETD. Use of NETD physical functions without the opticsmon service is not supported.
Procedure
# sudo systemctl enable --now opticsmon.service
In the log output, each line represents one set of diagnostics data from one optical module, that is, physical port.
With the opticsmon service running, diagnostics data is collected from the optical modules of all configured PCI physical function network devices. Data is collected once initially and then once every 24 hours as well as on any detected change to the link.
The collected monitoring data is automatically relayed to firmware for analysis similar to the monitoring of PCI adapters where firmware controls the PCI physical function such as Network Express in hybrid mode (NETH).
To check if data is being collected, consult the status of the opticsmon.service. Use the -a flag as systemd otherwise assumes the output to be in binary format:
# sudo systemctl status -a opticsmon.service
A command exists, see opticsmon - Collect diagnostics data from optical modules, however, normally you would use the service.