mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-18 14:54:23 +08:00
NET-1782: Fetch Node Connection Status from metrics (#3237)
* add live status of node * handle static node status * add public IP field to server configuration * get public Ip from config * improve node status logic * improvise status check * use only checkin status on old nodes --------- Co-authored-by: the_aceix <aceixsmartx@gmail.com>
This commit is contained in:
@@ -11,6 +11,19 @@ import (
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
)
|
||||
|
||||
type NodeStatus string
|
||||
|
||||
const (
|
||||
OnlineSt NodeStatus = "online"
|
||||
OfflineSt NodeStatus = "offline"
|
||||
WarningSt NodeStatus = "warning"
|
||||
ErrorSt NodeStatus = "error"
|
||||
UnKnown NodeStatus = "unknown"
|
||||
)
|
||||
|
||||
// LastCheckInThreshold - if node's checkin more than this threshold,then node is declared as offline
|
||||
const LastCheckInThreshold = time.Minute * 10
|
||||
|
||||
const (
|
||||
// NODE_SERVER_NAME - the default server name
|
||||
NODE_SERVER_NAME = "netmaker"
|
||||
@@ -103,6 +116,7 @@ type Node struct {
|
||||
IsStatic bool `json:"is_static"`
|
||||
IsUserNode bool `json:"is_user_node"`
|
||||
StaticNode ExtClient `json:"static_node"`
|
||||
Status NodeStatus `json:"node_status"`
|
||||
}
|
||||
|
||||
// LegacyNode - legacy struct for node model
|
||||
|
Reference in New Issue
Block a user