From 02c1bcfbf4e4e79fbd57175bc51cc4ee8804fdb4 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 13 Feb 2025 12:29:58 +0800 Subject: [PATCH] fix(lbagent): telegraf configuration panic (#22097) --- 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 01bde63641..1d70c36acc 100644 --- a/pkg/hostman/system_service/telegraf.go +++ b/pkg/hostman/system_service/telegraf.go @@ -214,7 +214,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]) }