How-To
25.1.2 to 25.1.9 Troubleshooting Remote Agent Unavailable
5 min
if a remote agents becomes unavailable, and the connections with tc are not reestablished until the remote agent container is restarted you can use the following to handle the below error add a new cron job with the user who runs the containers to restart automatically the remote agent when we detect the "unexpected error occurred during agent heartbeat" error message note in case you would like to apply this script, you need to edit the script and change the " agent container name " value open the script corresponding to the container technology you are using, docker or podman (scripts attached) edit the script > add the turbine agent name > save how to get the remote agent name? run the following to list the containers running docker/podman ps give execute permissions to the scripte i (change the file name to the correct script name) chmod +rwx remote agent monitoring (docker/podman) sh edit crontab crontab e add a cron job (change the all path if it's necessary, and the script name) /5 /home/\<user name>/remote agent monitoring sh >> /home/\<user name>/remote script log 2>&1 save press esc > \ wq code docker script \#! /usr/bin/env bash docker bin=$(which docker) \#docker bin="/usr/bin/cat" agent container name="\<replace with your agent container name>" agent logs=$(${docker bin} logs tail 20 "$agent container name" 2>&1 | grep "unexpected error occurred during agent heartbeat") \#agent logs=$(/usr/bin/cat logs txt 2>&1 | grep "unexpected error occurred during agent heartbeat") length=$(echo "$agent logs" | wc l) echo $length if \[\[ ! z "${agent logs}" && ${length} gt 5 ]]; then echo " restart agent $docker bin restart $agent container name" agent restart=$(${docker bin} restart "$agent container name") fi podman script \#! /usr/bin/env bash podman bin=$(which podman) \#podman bin="/usr/bin/cat" agent container name="\<replace with your agent container name>" agent logs=$(${podman bin} logs tail 20 "$agent container name" 2>&1 | grep "unexpected error occurred during agent heartbeat") \#agent logs=$(/usr/bin/cat logs txt 2>&1 | grep "unexpected error occurred during agent heartbeat") length=$(echo "$agent logs" | wc l)echo $length if \[\[ ! z "${agent logs}" && ${length} gt 5 ]]; then echo " restart agent $podman bin restart $agent container name" agent restart=$(${podman bin} restart "$agent container name") fi