diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-04-27 11:34:26 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-04-27 11:34:26 +0300 |
commit | de771dfe55cdca42e39fa1802bd0dfbfc9407011 (patch) | |
tree | 735836b12894b9c5d4d3ef8631179c7711a76d34 /plugins.d | |
parent | 577103e7d293397bfe7de7c23d792c6f340a10b5 (diff) |
cgroup-name.sh now extracts proper docker names #115
Diffstat (limited to 'plugins.d')
-rwxr-xr-x | plugins.d/cgroup-name.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins.d/cgroup-name.sh b/plugins.d/cgroup-name.sh index f0a89594ce..1be3aec1f8 100755 --- a/plugins.d/cgroup-name.sh +++ b/plugins.d/cgroup-name.sh @@ -26,8 +26,9 @@ fi if [ -z "${NAME}" -a "${CGROUP:0:7}" = "docker/" ] then - NAME="$(docker ps | grep "^${CGROUP:7:12}" | sed "s/[[:space:]]\+/ /g" | cut -d ' ' -f 2)" + NAME="$(docker ps --filter=id="${CGROUP:7:64}" --format="{{.Names}}")" [ -z "${NAME}" ] && NAME="${CGROUP:0:19}" + [ ${#NAME} -gt 20 ] && NAME="${NAME:0:20}" fi if [ -z "${NAME}" ] |