[agent-go] - 更新ServerInfo的字段
This commit is contained in:
@@ -13,7 +13,7 @@ type AgentServerInfo struct {
|
||||
ServerIPPbV6 string `json:"serverIpPbV6" yaml:"serverIpPbV6"`
|
||||
ServerIPInV6 string `json:"serverIpInV6" yaml:"serverIpInV6"`
|
||||
City string `json:"city" yaml:"city"`
|
||||
Region string `json:"region" yaml:"region"`
|
||||
Province string `json:"province" yaml:"province"`
|
||||
Country string `json:"country" yaml:"country"`
|
||||
Organization string `json:"organization" yaml:"organization"`
|
||||
TimeZone string `json:"timeZone" yaml:"timeZone"`
|
||||
@@ -31,6 +31,7 @@ type AgentServerInfo struct {
|
||||
PlatformVersion string `json:"platformVersion"` // version of the complete OS
|
||||
KernelVersion string `json:"kernelVersion"` // version of the OS kernel (if available)
|
||||
KernelArch string `json:"kernelArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
|
||||
CPUArch string `json:"cpuArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
|
||||
IoSpeed string `json:"ioSpeed" yaml:"ioSpeed"`
|
||||
MemoryTotal string `json:"memoryTotal" yaml:"memoryTotal"`
|
||||
SwapTotal string `json:"swapTotal" yaml:"swapTotal"`
|
||||
@@ -39,5 +40,5 @@ type AgentServerInfo struct {
|
||||
Comment string `json:"comment" yaml:"comment"`
|
||||
MachineID string `json:"machineId" yaml:"machineId"`
|
||||
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
|
||||
TopicName string `json:"topicName" yaml:"topicName"`
|
||||
AgentTopicName string `json:"agentTopicName" yaml:"agentTopicName"`
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func INIT(octopusAgentConfigFileName string) chan bool {
|
||||
}
|
||||
|
||||
// 建立 运行时 RabbitMQ连接
|
||||
runtimeConnectorQueue := buildAndStartBusinessRuntimeQueue(a_agent.AgentServerInfoCache.TopicName)
|
||||
runtimeConnectorQueue := buildAndStartBusinessRuntimeQueue(a_agent.AgentServerInfoCache.AgentTopicName)
|
||||
|
||||
// 激活子模块
|
||||
activatedOctopusAgentModules()
|
||||
@@ -318,6 +318,8 @@ func uniformAgentServerName(agentInfo *a_status.AgentInfo, agentServerInfo *a_ag
|
||||
// linux host architecture
|
||||
arch := getMachineType(agentInfo.HostInfo.KernelArch)
|
||||
|
||||
agentServerInfo.CPUArch = arch
|
||||
|
||||
var numS string
|
||||
if agentServerInfo.ServerIPInV4 != "" {
|
||||
split := strings.Split(agentServerInfo.ServerIPInV4, ".")
|
||||
@@ -433,7 +435,7 @@ func refreshAgentNetworkInfo(agentInfo *a_status.AgentInfo, agentServerInfo *a_a
|
||||
|
||||
if publicNetworkInfo.IP != "" {
|
||||
agentServerInfo.ServerIPPbV4 = publicNetworkInfo.IP
|
||||
agentServerInfo.Region = publicNetworkInfo.Region
|
||||
agentServerInfo.Province = publicNetworkInfo.Region
|
||||
agentServerInfo.City = publicNetworkInfo.City
|
||||
agentServerInfo.Country = publicNetworkInfo.Country
|
||||
agentServerInfo.Location = publicNetworkInfo.Loc
|
||||
@@ -507,7 +509,7 @@ func handleInitMsgFromServer(initFromServerMsg *rabbitmq.OctopusMessage, initToS
|
||||
g.G.AgentHasRegister = true
|
||||
|
||||
// 保存真实的AgentTopicName
|
||||
a_agent.AgentServerInfoCache.TopicName = serverInfo.TopicName
|
||||
a_agent.AgentServerInfoCache.AgentTopicName = serverInfo.AgentTopicName
|
||||
|
||||
} else {
|
||||
// 不是自身的 注册回复信息 -- 拒绝 2023年6月19日 此处存在错误! 会死循环Nack 导致异常
|
||||
|
||||
68
agent-go/octopus-agent-cmii.yaml
Normal file
68
agent-go/octopus-agent-cmii.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
server:
|
||||
port: 8000
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: info
|
||||
|
||||
octopus:
|
||||
message:
|
||||
# agent boot up default common exchange
|
||||
init_exchange: InitExchange
|
||||
# server will send message to agent using this common queue
|
||||
init_to_server: InitToServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_to_server_key: InitToServerKey
|
||||
# server will receive message from agent using this common queue
|
||||
init_from_server: InitFromServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_from_server_key: InitFromServerKey
|
||||
# initialization register time out (unit ms) default is 5 min
|
||||
init_ttl: "3000000"
|
||||
# Octopus Exchange Name == server comunicate with agent
|
||||
octopus_exchange: OctopusExchange
|
||||
# Octopus Message To Server == all agent send info to server queue and topic
|
||||
octopus_to_server: OctopusToServer
|
||||
executor:
|
||||
name: executor-functions
|
||||
status:
|
||||
name: octopus-agent
|
||||
healthy:
|
||||
type: cron
|
||||
cron: 10 */1 * * * ? *
|
||||
start-delay: 30
|
||||
metric:
|
||||
pinch: 20
|
||||
agent:
|
||||
executor:
|
||||
# agent执行一条Command的最长超时时间
|
||||
processMaxTimeOut: 60
|
||||
status:
|
||||
app:
|
||||
- Nginx/nginx
|
||||
- MySQL/mysql
|
||||
- Xray/xray
|
||||
- OctopusAgent/octopus-agent
|
||||
- Redis/redis
|
||||
- RabbitMQ/rabbitmq
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
rabbitmq:
|
||||
# host: 42.192.52.227
|
||||
host: 192.168.35.71
|
||||
port: 20672
|
||||
username: boge
|
||||
password: boge8tingH
|
||||
virtual-host: /
|
||||
listener:
|
||||
simple:
|
||||
retry:
|
||||
# ack failed will reentrant the Rabbit Listener
|
||||
max-attempts: 2
|
||||
enabled: true
|
||||
# retry interval unit ms
|
||||
max-interval: 65000
|
||||
initial-interval: 65000
|
||||
@@ -65,27 +65,4 @@ spring:
|
||||
enabled: true
|
||||
# retry interval unit ms
|
||||
max-interval: 65000
|
||||
initial-interval: 65000
|
||||
|
||||
#spring:
|
||||
# application:
|
||||
# name: octopus-agent
|
||||
# profiles:
|
||||
# active: dev
|
||||
# cloud:
|
||||
# nacos:
|
||||
# config:
|
||||
# group: dev
|
||||
# config-retry-time: 3000
|
||||
# file-extension: yaml
|
||||
# max-retry: 3
|
||||
# # server-addr: "150.230.198.103:21060"
|
||||
# server-addr: "42.192.52.227:21060"
|
||||
# timeout: 5000
|
||||
# config-long-poll-timeout: 5000
|
||||
# extension-configs:
|
||||
# - group: dev
|
||||
# data-id: "common-dev.yaml"
|
||||
#
|
||||
#server:
|
||||
# port: 8000
|
||||
initial-interval: 65000
|
||||
Reference in New Issue
Block a user