#!/bin/bash
#
# Check health state for processes inside podman container
# (needs a healthcheck command to be defined in the container config)
#
STATE=$(podman inspect --format='{{json .State.Health.Status}}' $1)

if [ "$STATE" == "\"healthy\"" ]; then
    echo "OK - All container services are running in $1";
    exit 0;
else
    echo "CRITICAL - Containers services not running in $1";
    exit 1;
fi

