From 1333cc7eee001a3297f2a556401920f12ea6cb47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o?= <theo@le-filament.com>
Date: Thu, 30 Jun 2022 09:50:54 +0200
Subject: [PATCH] add filter on stats

---
 check_docker.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check_docker.sh b/check_docker.sh
index 7fe4851..b7b2a67 100755
--- a/check_docker.sh
+++ b/check_docker.sh
@@ -50,7 +50,7 @@ done
 # Gathering facts.
 all_containers=$(sudo /usr/bin/docker ps --format '{{.Names}}' --filter "name=${filter}" --no-trunc --quiet --all)
 running_containers=$(sudo /usr/bin/docker ps --format '{{.Names}}' --filter "name=${filter}" --no-trunc --quiet)
-running_containers_stats=$(sudo /usr/bin/docker stats --format '{{.Name}}:{{.CPUPerc}}:{{.MemPerc}}' --no-stream)
+running_containers_stats=$(sudo /usr/bin/docker stats --format '{{.Name}}:{{.CPUPerc}}:{{.MemPerc}}' --filter "name=${filter}" --no-stream)
 
 not_running_containers=$(comm -23 <(echo $all_containers | /usr/bin/tr ' ' '\n') <(echo $running_containers | /usr/bin/tr ' ' '\n'))
 
-- 
GitLab