OpenWrt agent: get interface speed from sysfs if ethtool is missing #883
+13
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
General information
ethtool is not default on most OpenWrt targets and these devices are typically found in networking environments, so missing interface speed is not the desired behavior.
My personal preference would be omitting ethtool completely here and only use the sysfs approach (see last paragraph).
Bug reports
On OpenWrt devices (way back, at least current versions 24.10, 25.12-rc, snapshot) the Checkmk agent scripts only reports interface speed, duplex and negotiation, if ethtool is in the executable path. This is typically not the case on many devices.
Hence interface speed is always "unknown" while this information is likely of interest on a network device like a switch, router or access point.
Proposed changes
Adapt fallback from Linux agent (a7d348e) and extract speed from sysfs (
/sys/class/net/*) if ethtool is not available.This will only provide the speed information - which is the only piece of information that is processed by default AFAIK.
Output Diff (DSA based device):
show
Output Diff (swconfig based device):
show
Alternative, more sophisticated approach that also detects status and duplex:
Example output