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

tune output

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