Skip to content

Commit

Permalink
check_container.sh fixed for paused containers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-pickin-epi committed Sep 12, 2024
1 parent 281ad53 commit 82952f5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/check_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ PROG=$(basename $0)

check ()
{
docker top $NAME > /dev/null && docker container stats --no-stream $NAME 2>&1
case $? in
0)
exit $OK;;
1)
exit $CRITICAL;;
*) # Unknown service
exit $UNKNOWN;;
STATUS=$(docker container inspect $NAME 2> /dev/null | jq -r .[0].State.Status)

case $STATUS in
running)
docker container stats --no-stream $NAME 2>&1
exit $OK;;
*) [ "$STATUS" == "null" ] && echo "Container $NAME not running" || echo "Container $NAME $STATUS"
exit $CRITICAL;;
esac
}

Expand Down

0 comments on commit 82952f5

Please sign in to comment.