From 98ebad016b6bc2e818740ea03a62d661a9adbc68 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 23 Jun 2025 17:10:54 +0200
Subject: [PATCH] set status in dependency of "(healthy)" in status

---
 check_docker_info | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/check_docker_info b/check_docker_info
index 6db334b..95157fd 100755
--- a/check_docker_info
+++ b/check_docker_info
@@ -173,10 +173,8 @@ sStatus+=") .. "
 sStatus+="containers: $iCTotal running: $iCRunning paused: $iCPaused stopped: $iCStopped .. "
 sStatus+="images: $iImages"
 
-ph.status "$sStatus"
-echo "$out"
-
 if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then
+  out+="$(
     echo
     echo "Containers:"
     # containers=$( sudo -n --preserve-env docker ps --all --format '{"Names": "{{.Names}}", "State": "{{.State}}", "Status": "{{.Status}}" }' 2>/dev/null )
@@ -199,9 +197,16 @@ if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then
 
     done 
     echo
+  )"
+fi
 
+if grep -q "^??" <<< "$out"; then
+  ph.setStatus critical
 fi
 
+ph.status "$sStatus"
+echo "$out"
+
 # if -d was given then show debug infos too
 test $bOptDebug -eq 1 && ( echo; echo "DEBUG: full docker system infos as json"; echo "$data" | jq ; _debugInfos)
 
-- 
GitLab