diff options
author | Nate <nate.tade@gmail.com> | 2018-12-17 15:06:16 -0800 |
---|---|---|
committer | Costa Tsaousis <costa@tsaousis.gr> | 2018-12-17 15:06:16 -0800 |
commit | 2995b290815126ffdb60c48be7a560cd1c7fa4f9 (patch) | |
tree | 37bd56c7fe03557014d1fe699eeeeff2380133c4 /collectors/cgroups.plugin | |
parent | d2331320dd9cff5f2b8151dc652ecfcd4ce1402f (diff) |
Update cgroup-name.sh.in (#4991)
get the container name on ECS
Diffstat (limited to 'collectors/cgroups.plugin')
-rwxr-xr-x | collectors/cgroups.plugin/cgroup-name.sh.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/collectors/cgroups.plugin/cgroup-name.sh.in b/collectors/cgroups.plugin/cgroup-name.sh.in index 53696a4bf9..745c1c42f7 100755 --- a/collectors/cgroups.plugin/cgroup-name.sh.in +++ b/collectors/cgroups.plugin/cgroup-name.sh.in @@ -133,6 +133,19 @@ if [ -z "${NAME}" ] else error "a docker id cannot be extracted from docker cgroup '${CGROUP}'." fi + elif [[ "${CGROUP}" =~ ^.*ecs[-_/\.][a-fA-F0-9]+[-_\.]?.*$ ]] + then + # ECS + + DOCKERID="$( echo "${CGROUP}" | sed "s|^.*ecs[-_/].*[-_/]\([a-fA-F0-9]\+\)[-_\.]\?.*$|\1|" )" + # echo "DOCKERID=${DOCKERID}" + + if [ ! -z "${DOCKERID}" -a \( ${#DOCKERID} -eq 64 -o ${#DOCKERID} -eq 12 \) ] + then + docker_get_name "${DOCKERID}" + else + error "a docker id cannot be extracted from docker cgroup '${CGROUP}'." + fi elif [[ "${CGROUP}" =~ ^.*kubepods[_/].*[_/]pod[a-fA-F0-9-]+[_/][a-fA-F0-9]+$ ]] then # kubernetes |