mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-10 08:41:20 +08:00
add wg device for metrics if ICMP fails
This commit is contained in:
parent
6dcd801941
commit
40b52a6ed9
1 changed files with 9 additions and 0 deletions
|
|
@ -63,6 +63,15 @@ func Collect(iface string, peerMap models.PeerMap) (*models.Metrics, error) {
|
|||
newMetric.Latency = pingStats.AvgRtt.Milliseconds()
|
||||
}
|
||||
}
|
||||
// check device peer to see if WG is working if ping failed
|
||||
if !newMetric.Connected {
|
||||
if currPeer.ReceiveBytes > 0 &&
|
||||
currPeer.TransmitBytes > 0 &&
|
||||
time.Now().Before(currPeer.LastHandshakeTime.Add(time.Minute<<1)) {
|
||||
newMetric.Connected = true
|
||||
newMetric.Uptime = 1
|
||||
}
|
||||
}
|
||||
newMetric.TotalTime = 1
|
||||
metrics.Connectivity[id] = newMetric
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue