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]) }