mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
fix traffic sent and recieved metric
This commit is contained in:
parent
959ca622e3
commit
a701956d99
|
@ -367,8 +367,16 @@ func updateNodeMetrics(currentNode *models.Node, newMetrics *models.Metrics) boo
|
|||
currMetric.TotalReceived += oldMetric.TotalReceived
|
||||
currMetric.TotalSent += oldMetric.TotalSent
|
||||
} else {
|
||||
currMetric.TotalReceived += int64(math.Abs(float64(currMetric.TotalReceived) - float64(oldMetric.TotalReceived)))
|
||||
currMetric.TotalSent += int64(math.Abs(float64(currMetric.TotalSent) - float64(oldMetric.TotalSent)))
|
||||
if currMetric.TotalReceived < oldMetric.TotalReceived {
|
||||
currMetric.TotalReceived += oldMetric.TotalReceived
|
||||
} else {
|
||||
currMetric.TotalReceived += int64(math.Abs(float64(currMetric.TotalReceived) - float64(oldMetric.TotalReceived)))
|
||||
}
|
||||
if currMetric.TotalSent < oldMetric.TotalSent {
|
||||
currMetric.TotalSent += oldMetric.TotalSent
|
||||
} else {
|
||||
currMetric.TotalSent += int64(math.Abs(float64(currMetric.TotalSent) - float64(oldMetric.TotalSent)))
|
||||
}
|
||||
}
|
||||
if currMetric.Uptime == 0 || currMetric.TotalTime == 0 {
|
||||
currMetric.PercentUp = 0
|
||||
|
|
Loading…
Reference in a new issue