Skip to contentSkip to conversation

parsing the output of ethtool programmatically

DISCUSSION Robert Urban 3 participants 4 messages Jun 25, 2015 – Oct 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

there doesn't seem to be any flag to request ethtool to present its output in a script-friendly form. Things like:

Quoted 3 lines
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full

are kind of pain to parse.

Something to consider?

Robert Urban

#1 lore raw
Quoted 10 lines · Robert Urban

Hello,

there doesn't seem to be any flag to request ethtool to present its output in a script-friendly form. Things like:

Quoted 3 lines
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full

are kind of pain to parse.

Something to consider?

Or write a library for using SIOCETHTOOL. The interface is fairly well documented now and there are other users besides the ethtool utility.

Ben.

Signature · 2 lines
Ben Hutchings
friends: People who know you well, but like you anyway.
#2 lore raw
Quoted 5 lines · Ben Hutchings
Quoted 4 lines · Robert Urban

Hello,

there doesn't seem to be any flag to request ethtool to present its output in a script-friendly form. Things like:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
         Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                              100baseT/Half 100baseT/Full
                                              1000baseT/Full

are kind of pain to parse.

Something to consider?

Or write a library for using SIOCETHTOOL. The interface is fairly well documented now and there are other users besides the ethtool utility.

one of the requests which we usually get is ethtool output in json format. since iproute2 tools are already getting an option to print in json format, would be nice if we considered an option to print in json for ethtool too.

#3 lore raw

may I also suggest being able to specify the offload parameters in the format in which "ethtool -k <nic>" prints them? The user can only guess which -K parameters correspond to the -k parameters.

Quoted 21 lines · roopa
Quoted 5 lines · Ben Hutchings
Quoted 4 lines · Robert Urban

Hello,

there doesn't seem to be any flag to request ethtool to present its output in a script-friendly form.  Things like:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

         Link partner advertised link modes:  10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full

are kind of pain to parse.

Something to consider?

Or write a library for using SIOCETHTOOL.  The interface is fairly well documented now and there are other users besides the ethtool utility.

one of the requests which we usually get is ethtool output in json format. since iproute2 tools are already getting
an option to print in json format, would be nice if we considered an option to print in json for ethtool too.