organizing and refactoring
This commit is contained in:
parent
13b5474cd8
commit
6f159d4728
20 changed files with 832 additions and 488 deletions
36
agent/tactical/tactical.go
Normal file
36
agent/tactical/tactical.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package tactical
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/amidaware/rmmagent/agent/utils"
|
||||
"github.com/amidaware/rmmagent/shared"
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
func SyncMeshNodeID() bool {
|
||||
id, err := GetMeshNodeID()
|
||||
if err != nil {
|
||||
//a.Logger.Errorln("SyncMeshNodeID() getMeshNodeID()", err)
|
||||
return false
|
||||
}
|
||||
|
||||
agentConfig := NewAgentConfig()
|
||||
|
||||
payload := shared.MeshNodeID{
|
||||
Func: "syncmesh",
|
||||
Agentid: agentConfig.AgentID,
|
||||
NodeID: utils.StripAll(id),
|
||||
}
|
||||
|
||||
client := resty.New()
|
||||
client.SetBaseURL(agentConfig.BaseURL)
|
||||
client.SetTimeout(15 * time.Second)
|
||||
client.SetCloseConnection(true)
|
||||
if shared.DEBUG {
|
||||
client.SetDebug(true)
|
||||
}
|
||||
|
||||
_, err = client.R().SetBody(payload).Post("/api/v3/syncmesh/")
|
||||
return err == nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue