mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Issue #63 - improved interface parsing
This commit is contained in:
parent
4af31039c9
commit
88cc21fa9d
1 changed files with 5 additions and 4 deletions
|
@ -36,7 +36,8 @@ if [ ! -d "$RRD/net" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parsing network interfaces
|
# Parsing network interfaces
|
||||||
ifaces=$(cat /proc/net/dev |grep : |cut -f 1 -d : |sed -e "s/ //g")
|
ndev=$(cat /proc/net/dev)
|
||||||
|
ifaces=$(echo "$ndev" |grep : |cut -f 1 -d : |sed -e "s/ //g")
|
||||||
|
|
||||||
# Parsing excludes
|
# Parsing excludes
|
||||||
for exclude in $(echo ${RRD_IFACE_EXCLUDE//,/ }); do
|
for exclude in $(echo ${RRD_IFACE_EXCLUDE//,/ }); do
|
||||||
|
@ -62,9 +63,9 @@ for iface in $ifaces; do
|
||||||
|
|
||||||
# Parsing device stats
|
# Parsing device stats
|
||||||
if [ "$period" = 'daily' ]; then
|
if [ "$period" = 'daily' ]; then
|
||||||
raw_iface=$(grep "$iface:" /proc/net/dev |sed -e "s/:/ /")
|
x=$(echo "$ndev" |sed -e "s/^ *//" |grep "^$iface:" |sed -e "s/:/ /")
|
||||||
rx=$(echo "$raw_iface" |awk '{print $2}')
|
rx=$(echo "$x" |awk '{print $2}')
|
||||||
tx=$(echo "$raw_iface" |awk '{print $10}')
|
tx=$(echo "$x" |awk '{print $10}')
|
||||||
|
|
||||||
# Updating rrd database
|
# Updating rrd database
|
||||||
rrdtool update $RRD/net/$iface.rrd N:$rx:$tx
|
rrdtool update $RRD/net/$iface.rrd N:$rx:$tx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue