mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 16:57:51 +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:
@@ -445,6 +445,20 @@ func AddStaticNodestoList(nodes []models.Node) []models.Node {
|
||||
return nodes
|
||||
}
|
||||
|
||||
func AddStatusToNodes(nodes []models.Node) (nodesWithStatus []models.Node) {
|
||||
aclDefaultPolicyStatusMap := make(map[string]bool)
|
||||
for _, node := range nodes {
|
||||
if _, ok := aclDefaultPolicyStatusMap[node.Network]; !ok {
|
||||
// check default policy if all allowed return true
|
||||
defaultPolicy, _ := GetDefaultPolicy(models.NetworkID(node.Network), models.DevicePolicy)
|
||||
aclDefaultPolicyStatusMap[node.Network] = defaultPolicy.Enabled
|
||||
}
|
||||
GetNodeStatus(&node, aclDefaultPolicyStatusMap[node.Network])
|
||||
nodesWithStatus = append(nodesWithStatus, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetNetworkByNode - gets the network model from a node
|
||||
func GetNetworkByNode(node *models.Node) (models.Network, error) {
|
||||
|
||||
|
Reference in New Issue
Block a user