diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df7590fd02ce906c43b0e057724e08338e068c6..6be86f061158fb27a8702d9521b5d710ff9a1654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.3] - 2021-07-12 +### Fixed +- compliance with cAdvisor: + * container name (`name`) never starts with `/`, dropping leading slash too + * container id (`id`) is prefixed with `/docker/` + ## [1.0.2] - 2021-06-30 ### Fixed - dockermon textfile metrics documentation string now correctly prefixed with `# ` diff --git a/src/metric-generators/dockermon.sh b/src/metric-generators/dockermon.sh index f8444e9cd420f7e4ab17de4c90f5749225bb9f94..ee2a7caafa73d9a943ada737dfe38b1ba0be8583 100755 --- a/src/metric-generators/dockermon.sh +++ b/src/metric-generators/dockermon.sh @@ -15,9 +15,9 @@ CONTAINERS=$(docker ps -a -q) for i_container in ${CONTAINERS}; do i_container_status="$(docker inspect "${i_container}")" - i_container_name="$(echo "${i_container_status}" | jq -r '.[].Name')" + i_container_name="$(echo "${i_container_status}" | jq -r '.[].Name' | sed 's|^/||')" i_container_restart_count="$(echo "${i_container_status}" | jq -r '.[].RestartCount')" - i_container_id="$(echo "${i_container_status}" | jq -r '.[].Id')" + i_container_id="/docker/$(echo "${i_container_status}" | jq -r '.[].Id')" test -n "${i_container_name}" echo -n "${i_container_restart_count}" | grep -Eq "^[0-9]+$" echo -n "${i_container_id}" | grep -Eq "^[a-fA-F0-9]{12,}$"