fix(cgroups.plugin): handle containers no env vars (#18691)
Daniel Sampliner committed
Oct 6, 2024 at 08:31 UTC
a6805178be2a76a00743e1504e7b7d19b8a03e1d
1 file changed
+1
-1
src/collectors/cgroups.plugin/cgroup-name.sh.in
+1
-1
@@ -155,7 +155,7 @@ function docker_like_get_name_api() {
155
info "Running API command: curl \"${host}${path}\""
156
JSON=$(curl -sS "${host}${path}")
157
fi
158
- if OUTPUT=$(echo "${JSON}" | jq -r '.Config.Env[],"CONT_NAME=\(.Name)","IMAGE_NAME=\(.Config.Image)"') && [ -n "$OUTPUT" ]; then
158
+ if OUTPUT=$(echo "${JSON}" | jq -r '.Config.Env[]?,"CONT_NAME=\(.Name)","IMAGE_NAME=\(.Config.Image)"') && [ -n "$OUTPUT" ]; then
159
parse_docker_like_inspect_output "$OUTPUT"
160
fi
161
return 0