chore: add version and distribution for agent to avoid painc at start (#131)

* chore: add version and distribution for agent to avoid painc at start

* docs: add release notes

* docs: typo release notes

---------

Co-authored-by: hardy <luohf@infinilabs.com>
This commit is contained in:
Hardy 2025-02-14 11:26:49 +08:00 committed by GitHub
parent ea73bf9510
commit b44382327d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 17 deletions

View File

@ -6,6 +6,8 @@ elasticsearch:
name: $[[TASK_ID]]
cluster_uuid: $[[CLUSTER_UUID]]
enabled: true
distribution: $[[CLUSTER_DISTRIBUTION]]
version: $[[CLUSTER_VERSION]]
endpoints: $[[CLUSTER_ENDPOINT]]
discovery:
enabled: false

View File

@ -26,6 +26,7 @@ Information about release notes of INFINI Console is provided here.
- Add credential settings for agent in enrolling agent
- Add collection mode to cluster editing
- Add default roles to fix the issue (#114) (#130)
- Add agent connection config with `version` and `distribution` to avoid panic at start(#131)
## 1.28.1 (2025-01-24)

View File

@ -24,6 +24,7 @@ title: "版本历史"
- 在集群编辑中新增采集模式
- 当使用 Easysearch 存储指标时,自动为系统集群创建 Agent 指标写入最小权限用户 (#120)
- 修复 LDAP 用户映射增加默认权限组 (#114) (#130)
- Agent 连接 Easysearch 的配置信息中增加 `version``distribution` 来解决启动时退出问题 (#131)
## 1.28.1 (2025-01-24)

View File

@ -197,6 +197,13 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin
var username = ""
var password = ""
var version = ""
var distribution = ""
if metadata.Config != nil {
version = metadata.Config.Version
distribution = metadata.Config.Distribution
if metadata.Config.AgentCredentialID != "" {
credential, err := common2.GetCredential(metadata.Config.AgentCredentialID)
@ -215,6 +222,7 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin
password = auth.Password.Get()
}
}
}
nodeInfo, err := metadata2.GetNodeConfig(v.ClusterID, v.NodeUUID)
if err != nil {
@ -238,20 +246,21 @@ func getAgentIngestConfigs(instance string, items map[string]BindingItem) (strin
}
taskID := v.ClusterID + "_" + v.NodeUUID
buffer.Write([]byte(fmt.Sprintf("\n - name: \"%v\"\n path: ./config/task_config.tpl\n "+
"variable:\n "+
"TASK_ID: %v\n "+
"CLUSTER_ID: %v\n "+
"CLUSTER_UUID: %v\n "+
"NODE_UUID: %v\n "+
"CLUSTER_VERSION: %v\n "+
"CLUSTER_DISTRIBUTION: %v\n "+
"CLUSTER_ENDPOINT: [\"%v\"]\n "+
"CLUSTER_USERNAME: \"%v\"\n "+
"CLUSTER_PASSWORD: \"%v\"\n "+
"CLUSTER_LEVEL_TASKS_ENABLED: %v\n "+
"NODE_LEVEL_TASKS_ENABLED: %v\n "+
"NODE_LOGS_PATH: \"%v\"\n\n\n", taskID, taskID,
v.ClusterID, v.ClusterUUID, v.NodeUUID, nodeEndPoint, username, password, clusterLevelEnabled, nodeLevelEnabled, pathLogs)))
v.ClusterID, v.ClusterUUID, v.NodeUUID, version, distribution, nodeEndPoint, username, password, clusterLevelEnabled, nodeLevelEnabled, pathLogs)))
}
hash := util.MD5digest(buffer.String())