fix: incorrect cluster metric collection mode (#136)

This commit is contained in:
silenceqi 2025-02-14 15:47:13 +08:00 committed by GitHub
parent 7922a42513
commit acaf76a0b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -37,8 +37,11 @@ func GetMonitorState(clusterID string) string {
if conf == nil { if conf == nil {
panic(fmt.Errorf("config of cluster [%s] is not found", clusterID)) panic(fmt.Errorf("config of cluster [%s] is not found", clusterID))
} }
if conf.MonitorConfigs != nil && !conf.MonitorConfigs.NodeStats.Enabled && !conf.MonitorConfigs.IndexStats.Enabled { if conf.MetricCollectionMode == "" {
return elastic.ModeAgent if conf.MonitorConfigs != nil && !conf.MonitorConfigs.NodeStats.Enabled && !conf.MonitorConfigs.IndexStats.Enabled {
return elastic.ModeAgent
}
return elastic.ModeAgentless
} }
return elastic.ModeAgentless return conf.MetricCollectionMode
} }