Skip to content
Snippets Groups Projects
Commit 036935c8 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '6468-docs-and-harmonize' into 'master'

tune output of netio

See merge request !135
parents 25100731 4639e5bb
No related branches found
No related tags found
1 merge request!135tune output of netio
...@@ -72,18 +72,20 @@ typeset -i iSpeedTrans=0 ...@@ -72,18 +72,20 @@ typeset -i iSpeedTrans=0
typeset -i iTotalRead=0 typeset -i iTotalRead=0
typeset -i iTotalTrans=0 typeset -i iTotalTrans=0
data=$( cat /proc/net/dev | grep -E "(eth|en[ops][0-9]*)" ) data=$( cat /proc/net/dev | grep ":" | grep -v "lo:")
allInterfaces=$( cut -f 1 -d ":" <<< "$data" | tr -d " " ) allInterfaces=$( cut -f 1 -d ":" <<< "$data" | tr -d " " )
sInterface=$( ph.getValueWithParam "$allInterfaces" "i" "$@" | sort ) sInterface=$( ph.getValueWithParam "$allInterfaces" "i" "$@" | sort )
out="---------- Interfaces:"
# ----- loop over all interfaces # ----- loop over all interfaces
iCountInterfaces=$( wc -w <<< "$sInterface" ) iCountInterfaces=$( wc -w <<< "$sInterface" )
out=$(
for myinterface in $sInterface for myinterface in $sInterface
do do
echo
echo "--- ${myinterface}:"
line=$( grep "${myinterface}:" <<< "$data" ) line=$( grep "${myinterface}:" <<< "$data" )
if [ -n "$line" ] ; then if [ -n "$line" ] ; then
...@@ -97,9 +99,12 @@ out=$( ...@@ -97,9 +99,12 @@ out=$(
iSpeedRead=$( ph.perfdeltaspeed "netio-${myinterface}-rx" $iRead) iSpeedRead=$( ph.perfdeltaspeed "netio-${myinterface}-rx" $iRead)
iSpeedTrans=$(ph.perfdeltaspeed "netio-${myinterface}-tx" $iTrans) iSpeedTrans=$(ph.perfdeltaspeed "netio-${myinterface}-tx" $iTrans)
printf "%15s %15s %10s %-10s \n" "receive:" $iRead $iSpeedRead "byte/s" out+=$(
printf "%15s %15s %10s %-10s \n" "transmit:" $iTrans $iSpeedTrans "byte/s" printf "\n>>> %s\n" "${myinterface}"
printf "%15s %15s %10s %-10s \n" "receive:" $iRead $iSpeedRead "byte/s"
printf "%15s %15s %10s %-10s \n" "transmit:" $iTrans $iSpeedTrans "byte/s"
echo " "
)
ph.perfadd "rx-${myinterface}" "$iSpeedRead" ph.perfadd "rx-${myinterface}" "$iSpeedRead"
ph.perfadd "tx-${myinterface}" "$iSpeedTrans" ph.perfadd "tx-${myinterface}" "$iSpeedTrans"
...@@ -107,20 +112,20 @@ out=$( ...@@ -107,20 +112,20 @@ out=$(
iTotalTrans=$iTotalTrans+$iSpeedTrans iTotalTrans=$iTotalTrans+$iSpeedTrans
else else
ph.setStatus "unknown" ph.setStatus "unknown"
echo "The interface [${myinterface}] does not exist." out+=$( printf "\nERROR: The interface [${myinterface}] does not exist." )
fi fi
done done
echo
)
# ----- total # ----- total
if [ $iCountInterfaces -gt 1 ]; then if [ $iCountInterfaces -gt 1 ]; then
out+=$( out+=$(
echo "--- total:" echo
echo "---------- total:"
printf "%15s %10s %-10s \n" "receive:" $iTotalRead "byte/s" printf "%15s %10s %-10s \n" "receive:" $iTotalRead "byte/s"
printf "%15s %10s %-10s \n" "transmit:" $iTotalTrans "byte/s" printf "%15s %10s %-10s \n" "transmit:" $iTotalTrans "byte/s"
echo " "
) )
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment