From 3eab8e495f0b4757e40dfc1179b139428e94045b Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 13 Feb 2025 12:29:44 +0800 Subject: [PATCH] fix(lbagent): telegraf configuration panic (#22095) --- pkg/hostman/system_service/telegraf.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/hostman/system_service/telegraf.go b/pkg/hostman/system_service/telegraf.go index 0c9c7202cf..2675af7265 100644 --- a/pkg/hostman/system_service/telegraf.go +++ b/pkg/hostman/system_service/telegraf.go @@ -171,7 +171,9 @@ func (s *STelegraf) GetConfig(kwargs map[string]interface{}) string { "/run/onecloud/containerd/", "/var/lib/", } - ignorePathSegments = append(ignorePathSegments, kwargs["server_path"].(string)) + if sp, ok := kwargs["server_path"]; ok { + ignorePathSegments = append(ignorePathSegments, sp.(string)) + } for i := range ignorePathSegments { ignorePathSegments[i] = fmt.Sprintf("%q", ignorePathSegments[i]) }