Skip to content
Snippets Groups Projects
Commit f07b476e authored by František Řezníček's avatar František Řezníček
Browse files

Merge branch 'cAdvisor-metric-label-compliance-fixes' into 'master'

fix: cAdvisor metrics compliance - name and id label values

See merge request !2
parents 780a6bee c7f6f030
No related branches found
No related tags found
1 merge request!2fix: cAdvisor metrics compliance - name and id label values
Pipeline #94414 passed
...@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [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 ## [1.0.2] - 2021-06-30
### Fixed ### Fixed
- dockermon textfile metrics documentation string now correctly prefixed with `# ` - dockermon textfile metrics documentation string now correctly prefixed with `# `
......
...@@ -15,9 +15,9 @@ CONTAINERS=$(docker ps -a -q) ...@@ -15,9 +15,9 @@ CONTAINERS=$(docker ps -a -q)
for i_container in ${CONTAINERS}; do for i_container in ${CONTAINERS}; do
i_container_status="$(docker inspect "${i_container}")" 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_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}" test -n "${i_container_name}"
echo -n "${i_container_restart_count}" | grep -Eq "^[0-9]+$" echo -n "${i_container_restart_count}" | grep -Eq "^[0-9]+$"
echo -n "${i_container_id}" | grep -Eq "^[a-fA-F0-9]{12,}$" echo -n "${i_container_id}" | grep -Eq "^[a-fA-F0-9]{12,}$"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment