retrieve individual stats with ovs-vsctl instead of parsing the whole line
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 3 Oct 2012 16:29:49 +0000 (18:29 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 3 Oct 2012 16:29:49 +0000 (18:29 +0200)
planetlab/scripts/sliver-ovs.in

index 2a95797..9af130e 100755 (executable)
@@ -271,9 +271,8 @@ function gmap_report_once () {
     iface=$1; shift
     hostname=$1; shift
     linkid=$1; shift
-    report=$(ovs-vsctl get interface $iface statistics)
-    rx_bytes=$(echo $report | sed -e 's/^.*rx_bytes=//' -e 's/,.*$//')
-    tx_bytes=$(echo $report | sed -e 's/^.*tx_bytes=//' -e 's/,.*$//')
+    rx_bytes=$(ovs-vsctl get interface $iface statistics:rx_bytes)
+    tx_bytes=$(ovs-vsctl get interface $iface statistics:tx_bytes)
     rx_bits=$(($rx_bytes*8))
     tx_bits=$(($tx_bytes*8))
     now=$(date +%s).$(date +%N)