mirror of
https://github.com/OpenNebula/one.git
synced 2025-08-29 09:49:28 +03:00
F #4913: Add negative values check for performance manager
This commit is contained in:
@ -2366,42 +2366,42 @@ class VirtualMachine < Template
|
|||||||
nettx_kbpersec = 0
|
nettx_kbpersec = 0
|
||||||
if metrics['net.transmitted']
|
if metrics['net.transmitted']
|
||||||
metrics['net.transmitted'].each { |sample|
|
metrics['net.transmitted'].each { |sample|
|
||||||
nettx_kbpersec += sample
|
nettx_kbpersec += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
netrx_kbpersec = 0
|
netrx_kbpersec = 0
|
||||||
if metrics['net.bytesRx']
|
if metrics['net.bytesRx']
|
||||||
metrics['net.bytesRx'].each { |sample|
|
metrics['net.bytesRx'].each { |sample|
|
||||||
netrx_kbpersec += sample
|
netrx_kbpersec += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
read_kbpersec = 0
|
read_kbpersec = 0
|
||||||
if metrics['virtualDisk.read']
|
if metrics['virtualDisk.read']
|
||||||
metrics['virtualDisk.read'].each { |sample|
|
metrics['virtualDisk.read'].each { |sample|
|
||||||
read_kbpersec += sample
|
read_kbpersec += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
read_iops = 0
|
read_iops = 0
|
||||||
if metrics['virtualDisk.numberReadAveraged']
|
if metrics['virtualDisk.numberReadAveraged']
|
||||||
metrics['virtualDisk.numberReadAveraged'].each { |sample|
|
metrics['virtualDisk.numberReadAveraged'].each { |sample|
|
||||||
read_iops += sample
|
read_iops += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
write_kbpersec = 0
|
write_kbpersec = 0
|
||||||
if metrics['virtualDisk.write']
|
if metrics['virtualDisk.write']
|
||||||
metrics['virtualDisk.write'].each { |sample|
|
metrics['virtualDisk.write'].each { |sample|
|
||||||
write_kbpersec += sample
|
write_kbpersec += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
write_iops = 0
|
write_iops = 0
|
||||||
if metrics['virtualDisk.numberWriteAveraged']
|
if metrics['virtualDisk.numberWriteAveraged']
|
||||||
metrics['virtualDisk.numberWriteAveraged'].each { |sample|
|
metrics['virtualDisk.numberWriteAveraged'].each { |sample|
|
||||||
write_iops += sample
|
write_iops += sample if sample > 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user