diff --git a/.fastRequest/collections/Root/Default Group/directory.json b/.fastRequest/collections/Root/Default Group/directory.json
new file mode 100644
index 0000000..da8abdb
--- /dev/null
+++ b/.fastRequest/collections/Root/Default Group/directory.json
@@ -0,0 +1,9 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~Default Group",
+ "filePath": "~.fastRequest~collections~Root~Default Group~",
+ "groupId": "1",
+ "id": "1",
+ "name": "Default Group",
+ "type": 1
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/directory.json b/.fastRequest/collections/Root/directory.json
new file mode 100644
index 0000000..218c7cd
--- /dev/null
+++ b/.fastRequest/collections/Root/directory.json
@@ -0,0 +1,9 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root",
+ "filePath": "~.fastRequest~collections~Root~",
+ "groupId": "-1",
+ "id": "0",
+ "name": "Root",
+ "type": 1
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/ExecutionController/directory.json b/.fastRequest/collections/Root/server/ExecutionController/directory.json
new file mode 100644
index 0000000..36f435a
--- /dev/null
+++ b/.fastRequest/collections/Root/server/ExecutionController/directory.json
@@ -0,0 +1,8 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~ExecutionController",
+ "filePath": "~.fastRequest~collections~Root~server~ExecutionController~",
+ "id": "20230222093108443",
+ "name": "ExecutionController",
+ "type": 3
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/ExecutionController/patchCommandToAgentAll.rapi b/.fastRequest/collections/Root/server/ExecutionController/patchCommandToAgentAll.rapi
new file mode 100644
index 0000000..443ffbd
--- /dev/null
+++ b/.fastRequest/collections/Root/server/ExecutionController/patchCommandToAgentAll.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~ExecutionController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~ExecutionController~patchCommandToAgentAll.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.ExecutionController.patchCommandToAgentAll",
+ "name": "[命令]- 发送命令至所有的主机",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.ExecutionController",
+ "jsonDocument": "",
+ "method": "patchCommandToAgentAll",
+ "methodDescription": "[命令]- 发送命令至所有的主机",
+ "methodType": "POST",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/executor/command/all",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/executor/command/all",
+ "urlEncodedKeyValueListJson": "[{\"comment\":\"命令行\",\"customFlag\":2,\"enabled\":true,\"key\":\"commandList\",\"type\":\"String\",\"value\":\"apt-get,update\"},{\"comment\":\"\",\"customFlag\":2,\"enabled\":true,\"key\":\"type\",\"type\":\"String\",\"value\":\"\"}]",
+ "urlEncodedKeyValueListText": "commandList=apt-get,update\n&type=",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.ExecutionController.patchCommandToAgentAll",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/SchedulerController/createScriptScheduler.rapi b/.fastRequest/collections/Root/server/SchedulerController/createScriptScheduler.rapi
new file mode 100644
index 0000000..f702cd0
--- /dev/null
+++ b/.fastRequest/collections/Root/server/SchedulerController/createScriptScheduler.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~SchedulerController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~SchedulerController~createScriptScheduler.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.SchedulerController.createScriptScheduler",
+ "name": "新增一个定时脚本任务",
+ "paramGroup": {
+ "bodyKeyValueListJson": "{\n \"schedulerUuid\": \"\",\n \"name\": \"测试任务\",\n \"cronExpress\": \"30 */30 * * * ? *\",\n \"description\": \"这是注释内容\",\n \"scriptContent\": \"echo yes \\napt-get update \\necho no \\napt-get install nginx -y\",\n \"targetMachine\": \"Chengdu-amd64-98-98066f\",\n \"lastExecutionId\": null,\n \"lastExecutionResultKey\": \"\",\n \"lastExecutionStatus\": null ,\n \"createTime\": \"\",\n \"updateTime\": \"\",\n \"nextScheduleTime\": \"\",\n \"lastScheduleTime\": \"\"\n}",
+ "className": "io.wdd.rpc.controller.SchedulerController",
+ "jsonDocument": "{\n \"schedulerUuid\": \"No comment,Value =schedulerUuid_9dr3w\",\n \"name\": \"No comment,Value =name_ucmeh\",\n \"cronExpress\": \"No comment,Value =cronExpress_qbwqm\",\n \"description\": \"No comment,Value =description_drj0c\",\n \"scriptContent\": \"脚本任务的内容\",\n \"targetMachine\": \"执行目标机器agent_topic_name列表,使用, 分隔\",\n \"lastExecutionId\": \"与 execution_log表的主键对应,方便查询执行日志\",\n \"lastExecutionResultKey\": \"与 execution_log表的 result_key 对应,方便查询执行日志\",\n \"lastExecutionStatus\": \"任务上次执行状态\",\n \"createTime\": \"定时脚本任务创建时间\",\n \"updateTime\": \"上次更新时间\",\n \"nextScheduleTime\": \"任务下次计划执行时间\",\n \"lastScheduleTime\": \"任务上次计划执行时间\"\n}",
+ "method": "createScriptScheduler",
+ "methodDescription": "新增一个定时脚本任务",
+ "methodType": "POST",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/scheduler/script/create",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/scheduler/script/create",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.SchedulerController.createScriptScheduler",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/SchedulerController/directory.json b/.fastRequest/collections/Root/server/SchedulerController/directory.json
new file mode 100644
index 0000000..7cc508f
--- /dev/null
+++ b/.fastRequest/collections/Root/server/SchedulerController/directory.json
@@ -0,0 +1,8 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~SchedulerController",
+ "filePath": "~.fastRequest~collections~Root~server~SchedulerController~",
+ "id": "20230116173428298",
+ "name": "SchedulerController",
+ "type": 3
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/SchedulerController/queryAllQuartzJob.rapi b/.fastRequest/collections/Root/server/SchedulerController/queryAllQuartzJob.rapi
new file mode 100644
index 0000000..80338e0
--- /dev/null
+++ b/.fastRequest/collections/Root/server/SchedulerController/queryAllQuartzJob.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~SchedulerController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~SchedulerController~queryAllQuartzJob.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.SchedulerController.queryAllQuartzJob",
+ "name": "查询所有job",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.SchedulerController",
+ "jsonDocument": "",
+ "method": "queryAllQuartzJob",
+ "methodDescription": "查询所有job",
+ "methodType": "GET",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/scheduler/queryAllJob",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/scheduler/queryAllJob",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.SchedulerController.queryAllQuartzJob",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/SchedulerController/queryAllTriggers.rapi b/.fastRequest/collections/Root/server/SchedulerController/queryAllTriggers.rapi
new file mode 100644
index 0000000..6858ff6
--- /dev/null
+++ b/.fastRequest/collections/Root/server/SchedulerController/queryAllTriggers.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~SchedulerController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~SchedulerController~queryAllTriggers.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.SchedulerController.queryAllTriggers",
+ "name": "查询所有的触发器Trigger",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.SchedulerController",
+ "jsonDocument": "",
+ "method": "queryAllTriggers",
+ "methodDescription": "查询所有的触发器Trigger",
+ "methodType": "GET",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/scheduler/allTriggers",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/scheduler/allTriggers",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.SchedulerController.queryAllTriggers",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/SchedulerController/queryRunQuartzJob.rapi b/.fastRequest/collections/Root/server/SchedulerController/queryRunQuartzJob.rapi
new file mode 100644
index 0000000..3a2d4ec
--- /dev/null
+++ b/.fastRequest/collections/Root/server/SchedulerController/queryRunQuartzJob.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~SchedulerController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~SchedulerController~queryRunQuartzJob.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.SchedulerController.queryRunQuartzJob",
+ "name": "查询所有运行job",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.SchedulerController",
+ "jsonDocument": "",
+ "method": "queryRunQuartzJob",
+ "methodDescription": "查询所有运行job",
+ "methodType": "POST",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/scheduler/queryRunJob",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/scheduler/queryRunJob",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.SchedulerController.queryRunQuartzJob",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/StatusController/GetHealthyStatusAgentList.rapi b/.fastRequest/collections/Root/server/StatusController/GetHealthyStatusAgentList.rapi
new file mode 100644
index 0000000..0d673c6
--- /dev/null
+++ b/.fastRequest/collections/Root/server/StatusController/GetHealthyStatusAgentList.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~StatusController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~StatusController~GetHealthyStatusAgentList.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.StatusController.GetHealthyStatusAgentList",
+ "name": "[ 状态-Agent ] Map",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.StatusController",
+ "jsonDocument": "",
+ "method": "GetHealthyStatusAgentList",
+ "methodDescription": "[ 状态-Agent ] Map",
+ "methodType": "GET",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/status/status/agent",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/status/status/agent",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.StatusController.GetHealthyStatusAgentList",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/StatusController/ManualUpdateAgentStatus.rapi b/.fastRequest/collections/Root/server/StatusController/ManualUpdateAgentStatus.rapi
new file mode 100644
index 0000000..97f1b45
--- /dev/null
+++ b/.fastRequest/collections/Root/server/StatusController/ManualUpdateAgentStatus.rapi
@@ -0,0 +1,37 @@
+{
+ "activeGroup": "Default",
+ "apiParamGroup": {},
+ "childList": [],
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~StatusController",
+ "domain": "http://localhost:9999",
+ "enableEnv": "local",
+ "enableProject": "ProjectOctopus",
+ "filePath": "~.fastRequest~collections~Root~server~StatusController~ManualUpdateAgentStatus.rapi",
+ "headerList": [],
+ "id": "api_io.wdd.rpc.controller.StatusController.ManualUpdateAgentStatus",
+ "name": "手动更新Agent的状态",
+ "paramGroup": {
+ "bodyKeyValueListJson": "",
+ "className": "io.wdd.rpc.controller.StatusController",
+ "jsonDocument": "",
+ "method": "ManualUpdateAgentStatus",
+ "methodDescription": "手动更新Agent的状态",
+ "methodType": "POST",
+ "multipartKeyValueListJson": "[]",
+ "originUrl": "/octopus/server/status/agent/status/update",
+ "pathParamsKeyValueListJson": "[]",
+ "postScript": "",
+ "postType": "json",
+ "preScript": "",
+ "returnDocument": "{\n\t\"code\":\"No comment,Type =Number\",\n\t\"msg\":\"No comment,Type =String\",\n\t\"data\":{}\n}",
+ "tempId": "",
+ "url": "/octopus/server/status/agent/status/update",
+ "urlEncodedKeyValueListJson": "[]",
+ "urlEncodedKeyValueListText": "",
+ "urlParamsKeyValueListJson": "[]",
+ "urlParamsKeyValueListText": ""
+ },
+ "tempId": "id_io.wdd.rpc.controller.StatusController.ManualUpdateAgentStatus",
+ "type": 2
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/StatusController/directory.json b/.fastRequest/collections/Root/server/StatusController/directory.json
new file mode 100644
index 0000000..29f0ea3
--- /dev/null
+++ b/.fastRequest/collections/Root/server/StatusController/directory.json
@@ -0,0 +1,8 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server~StatusController",
+ "filePath": "~.fastRequest~collections~Root~server~StatusController~",
+ "id": "20230222092955736",
+ "name": "StatusController",
+ "type": 3
+}
\ No newline at end of file
diff --git a/.fastRequest/collections/Root/server/directory.json b/.fastRequest/collections/Root/server/directory.json
new file mode 100644
index 0000000..ee09b3f
--- /dev/null
+++ b/.fastRequest/collections/Root/server/directory.json
@@ -0,0 +1,8 @@
+{
+ "description": "",
+ "directory": "~.fastRequest~collections~Root~server",
+ "filePath": "~.fastRequest~collections~Root~server~",
+ "id": "20221230113234995",
+ "name": "server",
+ "type": 4
+}
\ No newline at end of file
diff --git a/.fastRequest/config/fastRequestCurrentProjectConfig.json b/.fastRequest/config/fastRequestCurrentProjectConfig.json
new file mode 100644
index 0000000..7d39a50
--- /dev/null
+++ b/.fastRequest/config/fastRequestCurrentProjectConfig.json
@@ -0,0 +1,37 @@
+{
+ "dataList": [
+ {
+ "hostGroup": [
+ {
+ "env": "local",
+ "url": "localhost:9090"
+ }
+ ],
+ "name": "OctpusGO"
+ }
+ ],
+ "envList": [
+ "local"
+ ],
+ "headerList": [],
+ "postScript": "",
+ "preScript": "",
+ "projectList": [
+ "OctpusGO"
+ ],
+ "syncModel": {
+ "branch": "master",
+ "domain": "https://github.com",
+ "enabled": false,
+ "namingPolicy": "byDoc",
+ "owner": "",
+ "repo": "",
+ "repoUrl": "",
+ "syncAfterRun": false,
+ "token": "",
+ "type": "github"
+ },
+ "urlEncodedKeyValueList": [],
+ "urlParamsKeyValueList": [],
+ "urlSuffix": ""
+}
\ No newline at end of file
diff --git a/.run/RunServerToRemote.run.xml b/.run/RunServerToRemote.run.xml
deleted file mode 100644
index 1005446..0000000
--- a/.run/RunServerToRemote.run.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.run/Server-dev.run.xml b/.run/Server-dev.run.xml
deleted file mode 100644
index 15e77dc..0000000
--- a/.run/Server-dev.run.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.run/SkipTest-Package.run.xml b/.run/SkipTest-Package.run.xml
deleted file mode 100644
index ebfa812..0000000
--- a/.run/SkipTest-Package.run.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/agent-go/logger/logger.go b/agent-go/logger/logger.go
index 8a0acc0..2c3ecb9 100644
--- a/agent-go/logger/logger.go
+++ b/agent-go/logger/logger.go
@@ -25,7 +25,7 @@ func NewLogger() (*Logger, error) {
LevelKey: "level",
TimeKey: "time",
//CallerKey: "caller",
- EncodeLevel: zapcore.CapitalColorLevelEncoder,
+ EncodeLevel: zapcore.CapitalLevelEncoder,
EncodeTime: zapcore.RFC3339TimeEncoder,
//EncodeCaller: zapcore.FullCallerEncoder,
},
diff --git a/agent-go/octopus-agent-dev.yaml b/agent-go/octopus-agent-dev.yaml
index 5179bdf..12c3a19 100644
--- a/agent-go/octopus-agent-dev.yaml
+++ b/agent-go/octopus-agent-dev.yaml
@@ -55,7 +55,7 @@ spring:
port: 20672
username: boge
password: boge8tingH
- virtual-host: /
+ virtual-host: /wdd
listener:
simple:
retry:
diff --git a/agent-go/rabbitmq/OMsgConnector.go b/agent-go/rabbitmq/OMsgConnector.go
index d02bc2b..4cd4c85 100644
--- a/agent-go/rabbitmq/OMsgConnector.go
+++ b/agent-go/rabbitmq/OMsgConnector.go
@@ -30,7 +30,6 @@ func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
// 建立 业务消息 返回队列
// 统一为 OctopusToServer
-
octopusToServerQueueName := agentConfig.GetString("octopus.message.octopus_to_server")
octopusToServerProp := &ConnectProperty{
diff --git a/agent-go/rabbitmq/OctopusMessage.go b/agent-go/rabbitmq/OctopusMessage.go
index 0b7eda7..69a0c1f 100644
--- a/agent-go/rabbitmq/OctopusMessage.go
+++ b/agent-go/rabbitmq/OctopusMessage.go
@@ -8,7 +8,6 @@ import (
"encoding/json"
"fmt"
"strings"
- "time"
)
var P = g.G.P
@@ -33,11 +32,11 @@ type OctopusMsgBuilder interface {
type OctopusMessage struct {
UUID string `json:"uuid"`
- InitTime time.Time `json:"init_time" format:"2023-03-21 16:38:30"`
+ InitTime string `json:"init_time" format:"2023-03-21 16:38:30"`
Type string `json:"type"`
Content interface{} `json:"content"`
Result interface{} `json:"result"`
- ACTime time.Time `json:"ac_time" format:"2023-03-21 16:38:30"`
+ ACTime string `json:"ac_time" format:"2023-03-21 16:38:30"`
}
func (om *OctopusMessage) Handle() {
@@ -52,7 +51,7 @@ func (om *OctopusMessage) Send(rabbitQueue *RabbitQueue, msg []byte) {
func (om *OctopusMessage) Build(omType string, content interface{}) *OctopusMessage {
// 当前时间
- curTimeString := utils.CurTimeString()
+ curTimeString := utils.ParseDateTimeTime()
// must write to string format, otherwise it's very hard to deserialize
bytes, err := json.Marshal(content)
@@ -62,11 +61,11 @@ func (om *OctopusMessage) Build(omType string, content interface{}) *OctopusMess
return &OctopusMessage{
UUID: curTimeString,
- InitTime: time.Now(),
+ InitTime: curTimeString,
Type: omType,
Content: string(bytes),
Result: nil,
- ACTime: time.Time{},
+ ACTime: curTimeString,
}
}
@@ -134,7 +133,7 @@ func statusOMHandler(octopusMessage *OctopusMessage) {
}
var statusRes string
- if strings.HasPrefix(statusMessage.Type, "p") {
+ if strings.HasPrefix(statusMessage.StatusType, "P") {
// ping info
statusRes = status.Ping()
} else {
@@ -144,7 +143,14 @@ func statusOMHandler(octopusMessage *OctopusMessage) {
}
// 返回消息
+ // 组装消息
+ octopusMessage.ACTime = utils.ParseDateTimeTime()
+ octopusMessage.Result = statusRes
+ // 发送回去
+ statusOctopusReplayMessage, _ := json.Marshal(octopusMessage)
+ OctopusToServerQueue.Send(statusOctopusReplayMessage)
+ // 输出日志
log.InfoF("接收到查询Agent状态的请求,结果为 => %s", statusRes)
}
diff --git a/agent-go/register/AgentInitialization.go b/agent-go/register/AgentInitialization.go
index 62e72bf..f0a02a0 100644
--- a/agent-go/register/AgentInitialization.go
+++ b/agent-go/register/AgentInitialization.go
@@ -22,20 +22,20 @@ func INIT() *AgentServerInfo {
// 获取系统的环境变量
agentServerInfo := parseAgentServerInfo()
- nacosConfig := g.G.AgentConfig
+ agentConfig := g.G.AgentConfig
initToServerProp := &rabbitmq.ConnectProperty{
- ExchangeName: nacosConfig.GetString("octopus.message.init_exchange"),
- QueueName: nacosConfig.GetString("octopus.message.init_to_server"),
+ ExchangeName: agentConfig.GetString("octopus.message.init_exchange"),
+ QueueName: agentConfig.GetString("octopus.message.init_to_server"),
ExchangeType: g.QueueDirect,
- TopicKey: nacosConfig.GetString("octopus.message.init_to_server_key"),
+ TopicKey: agentConfig.GetString("octopus.message.init_to_server_key"),
}
initFromServerProp := &rabbitmq.ConnectProperty{
- ExchangeName: nacosConfig.GetString("octopus.message.init_exchange"),
- QueueName: nacosConfig.GetString("octopus.message.init_from_server"),
+ ExchangeName: agentConfig.GetString("octopus.message.init_exchange"),
+ QueueName: agentConfig.GetString("octopus.message.init_from_server"),
ExchangeType: g.QueueDirect,
- TopicKey: nacosConfig.GetString("octopus.message.init_from_server_key"),
+ TopicKey: agentConfig.GetString("octopus.message.init_from_server_key"),
}
// 建立RabbitMQ的连接
@@ -96,6 +96,9 @@ func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToSe
initOctopusMessageDeliveries := initFromServerQueue.Read(false)
+ // 2023年6月19日 修复注册信息一直没有完全消费的问题
+ findRealAgentTopicName := ""
+
// 同步很多抢占注册的情况
for delivery := range initOctopusMessageDeliveries {
@@ -128,29 +131,34 @@ func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToSe
// 修改系统参数
g.G.AgentHasRegister = true
- // 建立 运行时 RabbitMQ连接
- agentTopicName := initOctopusMsg.Result.(string)
- rabbitmq.BuildOMsgRuntimeConnectorQueue(agentTopicName)
+ // 保存真实的AgentTopicName
+ findRealAgentTopicName = serverInfo.TopicName
// 手动关闭 注册队列的连接
shutdownRegisterQueueConnection(initFromServerQueue, initToServerQueue)
- return
+
+ } else {
+ // 不是自身的 注册回复信息 -- 拒绝 2023年6月19日 此处存在错误! 会死循环Nack 导致异常
+ log.Warn(fmt.Sprintf("OctopusMessage INIT from server not this agent ! => %v, ==>%s", initOctopusMsg, delivery.Body))
+ delivery.Ack(false)
+
+ // 需要休眠等待不再获取相应的信息
+ time.Sleep(5 * time.Second)
}
-
- // 不是自身的 注册回复信息 -- 拒绝
- log.Warn(fmt.Sprintf("OctopusMessage INIT from server not this agent ! => %v, ==>%s", initOctopusMsg, delivery.Body))
- delivery.Nack(false, true)
-
- // 需要休眠等待不再获取相应的信息
- time.Sleep(5 * time.Second)
-
}
+ // 建立 运行时 RabbitMQ连接
+ rabbitmq.BuildOMsgRuntimeConnectorQueue(findRealAgentTopicName)
+
}
// shutdownRegisterQueueConnection 关闭初始化连接的两个队列
func shutdownRegisterQueueConnection(initFromServerQueue *rabbitmq.RabbitQueue, initToServerQueue *rabbitmq.RabbitQueue) {
- log.InfoF("Shutdown register queue connection !")
+
+ initFromServerQueue.Close()
+ initToServerQueue.Close()
+
+ log.InfoF("Pretend to Shutdown register queue connection !")
}
func parseAgentServerInfo() *AgentServerInfo {
diff --git a/agent-go/register/AgentServerInfo.go b/agent-go/register/AgentServerInfo.go
index 3026134..b39825e 100644
--- a/agent-go/register/AgentServerInfo.go
+++ b/agent-go/register/AgentServerInfo.go
@@ -22,5 +22,5 @@ type AgentServerInfo struct {
Comment string `json:"comment" yaml:"comment"`
MachineID string `json:"machineId" yaml:"machineId"`
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
- AgentTopicName string `json:"agentTopicName" yaml:"agentTopicName"`
+ TopicName string `json:"topicName" yaml:"topicName"`
}
diff --git a/agent-go/server-env.yaml b/agent-go/server-env.yaml
index 4bf3f5d..dd5ab75 100644
--- a/agent-go/server-env.yaml
+++ b/agent-go/server-env.yaml
@@ -17,6 +17,6 @@ osKernelInfo: "5.4.0-135-generic"
tcpControl: "cubic"
virtualization: "Dedicated"
ioSpeed: "150 MB/s"
-machineId: ""
+machineId: "fakemachinid123"
agentVersion: ""
-agentTopicName: ""
+topicName: ""
diff --git a/agent-go/status/Status.go b/agent-go/status/Status.go
index 63d65db..8ab5626 100644
--- a/agent-go/status/Status.go
+++ b/agent-go/status/Status.go
@@ -11,14 +11,13 @@ var log = logger2.Log
type StatusMessage struct {
/**
* which kind of status should be return
- * metric => short time message
- * all => all agent status message
- * healthy => check for healthy
+ "PING";
+ * METRIC => short time message
+ * ALL => all agent status message
* */
- Type string `json:"type,omitempty"`
- AgentTopicName string `json:"agent_topic_name,omitempty"`
- MetricRepeatCount int `json:"metric_repeat_count,omitempty"`
- metricRepeatPinch int `json:"metric_repeat_pinch,omitempty"`
+ StatusType string `json:"statusType,omitempty"`
+ MetricRepeatCount int `json:"metricRepeatCount,omitempty"`
+ metricRepeatPinch int `json:"metricRepeatPinch,omitempty"`
}
type AgentStatus struct {
diff --git a/agent-go/tmp/init-from-server-message.json b/agent-go/tmp/init-from-server-message.json
new file mode 100644
index 0000000..6660562
--- /dev/null
+++ b/agent-go/tmp/init-from-server-message.json
@@ -0,0 +1,5 @@
+{
+ "uuid\":\"Chengdu-amd64-98-fakema\",\"init_time\":\"2023-06-19 15:21:02\",\"type\":\"INIT\",\"content\":\"{\\\"serverName\\\":\\\"Chengdu-amd64-98\\\",\\\"serverIpPbV4\\\":\\\"183.220.149.17\\\",\\\"serverIpInV4\\\":\\\"\\\",\\\"serverIpPbV6\\\":\\\"\\\",\\\"serverIpInV6\\\":\\\"\\\",\\\"registerTime\\\":null,\\\"expireTime\\\":null,\\\"createTime\\\":null,\\\"updateTime\\\":null,\\\"proxyType\\\":null,\\\"location\\\":\\\"Chengdu Sichuan CN\\\",\\\"provider\\\":\\\"AS139080 The Internet Data Center of Sichuan Mobile Communication Company Limited\\\",\\\"managePort\\
+ \
+ ":\\\"22\\\",\\\"cpuBrand\\\":\\\"Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz\\\",\\\"cpuCore\\\":\\\"12 @ 4299.998 MHz\\\",\\\"memoryTotal\\\":\\\"7.6 GB\\\",\\\"diskTotal\\\":\\\"914.9 GB\\\",\\\"diskUsage\\\":\\\"12.3 GB\\\",\\\"ioSpeed\\\":\\\"150 MB/s\\\",\\\"tcpControl\\\":\\\"cubic\\\",\\\"virtualization\\\":\\\"Dedicated\\\",\\\"osInfo\\\":\\\"Ubuntu 20.04.5 LTS\\\",\\\"osKernelInfo\\\":\\\"5.4.0-135-generic\\\",\\\"machineId\\\":\\\"fakemachinid123\\\",\\\"topicName\\\":\\\"Chengdu-amd64-98-fakema\\\",\\\"comment\\\":\\\"\\\",\\\"agentVersion\\\":\\\"\\\"}\",\"result\":null,\"ac_time\":null}"
+}
\ No newline at end of file
diff --git a/agent-go/tmp/init-to-server-message.json b/agent-go/tmp/init-to-server-message.json
new file mode 100644
index 0000000..24de275
--- /dev/null
+++ b/agent-go/tmp/init-to-server-message.json
@@ -0,0 +1,8 @@
+{
+ "uuid": "2023-06-19 14:29:20",
+ "init_time": "2023-06-19 14:29:20",
+ "type": "INIT",
+ "content": "{\"serverName\":\"Chengdu-amd64-98\",\"serverIpPbV4\":\"183.220.149.17\",\"serverIpInV4\":\"\",\"serverIpPbV6\":\"\",\"serverIpInV6\":\"\",\"location\":\"Chengdu Sichuan CN\",\"provider\":\"AS139080 The Internet Data Center of Sichuan Mobile Communication Company Limited\",\"managePort\":\"22\",\"cpuCore\":\"12 @ 4299.998 MHz\",\"cpuBrand\":\"Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz\",\"osInfo\":\"Ubuntu 20.04.5 LTS\",\"osKernelInfo\":\"5.4.0-135-generic\",\"tcpControl\":\"cubic\",\"virtualization\":\"Dedicated\",\"ioSpeed\":\"150 MB/s\",\"memoryTotal\":\"7.6 GB\",\"diskTotal\":\"914.9 GB\",\"diskUsage\":\"12.3 GB\",\"comment\":\"\",\"machineId\":\"\",\"agentVersion\":\"\",\"agentTopicName\":\"\"}",
+ "result": null,
+ "ac_time": "2023-06-19 14:29:20"
+}
\ No newline at end of file
diff --git a/agent-go/utils/TimeUtils.go b/agent-go/utils/TimeUtils.go
index 0981dca..be6d10a 100644
--- a/agent-go/utils/TimeUtils.go
+++ b/agent-go/utils/TimeUtils.go
@@ -4,13 +4,18 @@ import (
"time"
)
-// CurTimeString 输出系统时间的格式为"2006-01-02 15:04:05"形式的时间字符串
-func CurTimeString() string {
+// ParseDateTimeTime 输出系统时间的格式为"2006-01-02 15:04:05"形式的时间字符串
+func ParseDateTimeTime() string {
now := time.Now()
/*loc := time.FixedZone("UTC+8", 8*60*60) // 创建东八区时区对象
localTime := now.In(loc) // 转换为东八区时间*/
- return now.Format("2006-01-02 15:04:05")
+ return now.Format(time.DateTime)
+}
+
+func ParseISOLocalDateTime() string {
+ now := time.Now()
+ return now.Format(time.RFC3339)
}
diff --git a/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java b/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java
index 8bdbe49..501e4b7 100644
--- a/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java
+++ b/server/src/main/java/io/wdd/rpc/init/AcceptAgentInitInfo.java
@@ -1,9 +1,11 @@
package io.wdd.rpc.init;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel;
import io.wdd.common.handler.MyRuntimeException;
+import io.wdd.common.utils.TimeUtils;
import io.wdd.rpc.message.OctopusMessage;
import io.wdd.rpc.message.OctopusMessageType;
import io.wdd.rpc.message.sender.OMessageToAgentSender;
@@ -22,10 +24,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
-import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
+import static io.wdd.common.utils.OctopusObjectMapperConfig.OctopusObjectMapper;
+
/**
* The type Accept boot up info message.
*/
@@ -108,8 +111,13 @@ public class AcceptAgentInitInfo {
try {
- serverInfoVO = objectMapper.readValue(
+ OctopusMessage initOctopusMessageFromAgent = OctopusObjectMapper.readValue(
message.getBody(),
+ OctopusMessage.class
+ );
+
+ serverInfoVO = OctopusObjectMapper.readValue(
+ (String) initOctopusMessageFromAgent.getContent(),
ServerInfoVO.class
);
@@ -126,6 +134,7 @@ public class AcceptAgentInitInfo {
// if (!checkAgentAlreadyRegister(agentQueueTopic)) {
// log.info("[AGENT INIT] - agent not exist ! start to register !");
// }
+
// whether agent is registered already
// save or update the octopus agent server info
// 3. save the agent info into database
@@ -135,7 +144,7 @@ public class AcceptAgentInitInfo {
}
// 4. generate the Octopus Agent Status Redis Stream Key & Consumer-Group
- generateAgentStatusRedisStreamConsumerGroup(serverInfoVO.getTopicName());
+ //generateAgentStatusRedisStreamConsumerGroup(serverInfoVO.getTopicName());
// 5. send InitMessage to agent
sendInitMessageToAgent(serverInfoVO);
@@ -169,7 +178,7 @@ public class AcceptAgentInitInfo {
*/
- throw new MyRuntimeException(" Octopus Server Initialization Error, please check !");
+ throw new MyRuntimeException("Octopus Server Initialization Error, please check !");
}
/**
@@ -208,18 +217,6 @@ public class AcceptAgentInitInfo {
);
}
- // check for octopus-server consumer group
- /*if (redisTemplate.opsForStream().groups(statusStreamKey)
- .stream()
- .filter(
- group -> group.groupName().startsWith("Octopus")
- ).collect(Collectors.toSet()).contains(Boolean.FALSE)) {
-
-
-
- redisTemplate.opsForStream().createGroup(statusStreamKey, "OctopusServer");
- }*/
-
log.debug(
"octopus agent [ {} ] status report stream key [ {} ] has been created !",
agentTopicName,
@@ -240,16 +237,24 @@ public class AcceptAgentInitInfo {
private boolean sendInitMessageToAgent(ServerInfoVO serverInfoVO) {
- OctopusMessage octopusMessage = OctopusMessage
- .builder()
- .type(OctopusMessageType.INIT)
- // should be the OctopusExchange Name
- .content(String.valueOf(initRabbitMQConfig.OCTOPUS_EXCHANGE))
- .init_time(LocalDateTime.now())
- .uuid(serverInfoVO.getTopicName())
- .build();
+ try {
+ String serverInfoContent = OctopusObjectMapper.writeValueAsString(serverInfoVO);
+
+ OctopusMessage octopusMessage = OctopusMessage
+ .builder()
+ .type(OctopusMessageType.INIT)
+ // should be the OctopusExchange Name
+ .content(serverInfoContent)
+ .init_time(TimeUtils.currentFormatTime())
+ .uuid(serverInfoVO.getTopicName())
+ .build();
+
+ oMessageToAgentSender.sendINIT(octopusMessage);
+
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException(e);
+ }
- oMessageToAgentSender.sendINIT(octopusMessage);
return true;
}
diff --git a/server/src/main/java/io/wdd/rpc/message/sender/OMessageToAgentSender.java b/server/src/main/java/io/wdd/rpc/message/sender/OMessageToAgentSender.java
index e4e5fbc..56dd6e6 100644
--- a/server/src/main/java/io/wdd/rpc/message/sender/OMessageToAgentSender.java
+++ b/server/src/main/java/io/wdd/rpc/message/sender/OMessageToAgentSender.java
@@ -44,32 +44,46 @@ public class OMessageToAgentSender {
}
// send to Queue -- InitFromServer
- log.info("send INIT OrderCommand to Agent = {}", message);
+ log.info(
+ "send INIT OrderCommand to Agent = {}",
+ message
+ );
- rabbitTemplate.convertAndSend(initRabbitMQConfig.INIT_EXCHANGE, initRabbitMQConfig.INIT_FROM_SERVER_KEY, writeData(message));
+ rabbitTemplate.convertAndSend(
+ initRabbitMQConfig.INIT_EXCHANGE,
+ initRabbitMQConfig.INIT_FROM_SERVER_KEY,
+ writeData(message)
+ );
}
public void send(OctopusMessage octopusMessage) {
- log.debug("OctopusMessage {} send to agent {}", octopusMessage, octopusMessage.getUuid());
+ log.debug(
+ "OctopusMessage {} send to agent {}",
+ octopusMessage,
+ octopusMessage.getUuid()
+ );
rabbitTemplate.convertAndSend(
initRabbitMQConfig.OCTOPUS_EXCHANGE,
octopusMessage.getUuid() + "*",
- writeData(octopusMessage));
+ writeData(octopusMessage)
+ );
}
public void send(List octopusMessageList) {
- octopusMessageList.stream().forEach(
- octopusMessage -> {
- this.send(octopusMessage);
- }
- );
+ octopusMessageList
+ .stream()
+ .forEach(
+ octopusMessage -> {
+ this.send(octopusMessage);
+ }
+ );
}
diff --git a/server/src/main/java/io/wdd/rpc/scheduler/service/BuildStatusScheduleTask.java b/server/src/main/java/io/wdd/rpc/scheduler/service/BuildStatusScheduleTask.java
index 009238d..ae2353d 100644
--- a/server/src/main/java/io/wdd/rpc/scheduler/service/BuildStatusScheduleTask.java
+++ b/server/src/main/java/io/wdd/rpc/scheduler/service/BuildStatusScheduleTask.java
@@ -43,7 +43,7 @@ public class BuildStatusScheduleTask {
private void buildAll() {
// Agent存活健康状态检查
- buildMonitorAllAgentStatusScheduleTask();
+ buildMonitorAllAgentAliveStatusScheduleTask();
// Agent运行信息检查 Metric
@@ -99,12 +99,12 @@ public class BuildStatusScheduleTask {
* 延迟触发时间 healthyCheckStartDelaySeconds
* 定时任务间隔 healthyCronTimeExpress
*/
- private void buildMonitorAllAgentStatusScheduleTask() {
+ private void buildMonitorAllAgentAliveStatusScheduleTask() {
// build the Job
octopusQuartzService.addMission(
AgentAliveStatusMonitorJob.class,
- "monitorAllAgentStatusJob",
+ "monitorAllAgentAliveStatusJob",
JOB_GROUP_NAME,
healthyCheckStartDelaySeconds,
healthyCronTimeExpress,
diff --git a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java
index 22854f4..fa423df 100644
--- a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java
+++ b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java
@@ -49,8 +49,7 @@ public class AgentAliveStatusMonitorService {
@Resource
AsyncStatusService asyncStatusService;
-
- private HashMap AGENT_HEALTHY_INIT_MAP;
+ private HashMap AGENT_HEALTHY_INIT_MAP;
public void go() {
@@ -77,29 +76,27 @@ public class AgentAliveStatusMonitorService {
updateAllAgentHealthyStatus(agentAliveStatusMap);
}
+ /**
+ * 初始化Agent存活状态的Redis缓存的信息,全部设置为False,然后等待存活状态检测
+ */
private void checkOrCreateRedisHealthyKey() {
// 检查开始的时候 需要手动将所有Agent的状态置为0
// Agent如果存活,那么就可以将其自身状态修改为1
// build the redis all agent healthy map struct
- HashMap initMap = new HashMap<>(32);
+ HashMap initMap = new HashMap<>(32);
ALL_AGENT_TOPIC_NAME_LIST
.stream()
.forEach(
agentTopicName -> {
initMap.put(
agentTopicName,
- "0"
+ Boolean.FALSE
);
}
);
- initMap.put(
- "updateTime",
- TimeUtils.currentTimeString()
- );
-
// cache this map struct
AGENT_HEALTHY_INIT_MAP = initMap;
@@ -111,6 +108,14 @@ public class AgentAliveStatusMonitorService {
initMap
);
+ redisTemplate
+ .opsForHash()
+ .put(
+ ALL_AGENT_STATUS_REDIS_KEY,
+ "initTime",
+ TimeUtils.currentTimeString()
+ );
+
}
public void updateAllAgentHealthyStatus(Map agentAliveStatusMap) {
@@ -123,6 +128,12 @@ public class AgentAliveStatusMonitorService {
// 执行Metric上报定时任务
// buildStatusScheduleTask.buildAgentMetricScheduleTask();
+ log.debug(
+ "[存活状态] - 当前时间为 [ %s ] , 所有的Agent存活状态为=> %s",
+ currentTimeString,
+ agentAliveStatusMap
+ );
+
// 这里仅仅是更新时间
redisTemplate
.opsForHash()
diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml
index e1c8ba9..4cdbd16 100644
--- a/server/src/main/resources/application.yml
+++ b/server/src/main/resources/application.yml
@@ -10,7 +10,7 @@ spring:
port: 20672
username: boge
password: boge8tingH
- virtual-host: /
+ virtual-host: /wdd
listener:
simple:
retry:
@@ -118,7 +118,7 @@ octopus:
name: octopus-agent
healthy:
type: cron
- cron: 10 */1 * * * ? *
+ cron: 10 * * * * ? *
start-delay: 30
metric:
pinch: 20