1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-25 02:50:08 +03:00

bug #2404: collect network trafic from all eth and bond interfaces

This commit is contained in:
Javi Fontan 2013-10-30 16:13:56 +01:00
parent 61ff108069
commit da1103733e

View File

@ -22,7 +22,7 @@ def print_info(name, value)
end
######
# First, get all the posible info out of virsh
# First, get all the posible info out of virsh
# TODO : use virsh freecell when available
######
@ -43,7 +43,7 @@ nodeinfo_text.split(/\n/).each{|line|
# for everything else, top & proc
#####
NETINTERFACE = "eth1"
NETINTERFACE = "eth|bond"
top_text=`top -bin2`
exit(-1) if $?.exitstatus != 0
@ -74,12 +74,14 @@ $free_memory=tmp[1]
net_text=`cat /proc/net/dev`
exit(-1) if $?.exitstatus != 0
$netrx = 0
$nettx = 0
net_text.split(/\n/).each{|line|
if line.match("^ *#{NETINTERFACE}")
arr = line.split(":")[1].split(" ")
$netrx = arr[0]
$nettx = arr[8]
break
$netrx += arr[0].to_i
$nettx += arr[8].to_i
end
}