Check RPA hub health
The following script can be used to check whether all the hubs registered in the quota are up and running.
note
If SSL is not configured, use http instead of https.
$ cat ./check_hub.sh
#!/bin/bash
APPALL=`find /opt/workfusion/ -type d -name app-all -print`
CONF=$APPALL/environment.conf
source $CONF
QUOTA=${INSTALL_DIR}/apps/rpa_manager/grid-router/quota/${1}.xml
USERS=${INSTALL_DIR}/apps/rpa_manager/grid-router/users.properties
sed 's/\, /\:/' ${USERS} | grep ${1} | while IFS=":" read user password quota;
do
echo "user='$user' password='$password' quota='$quota'";
egrep 'host|port' ${QUOTA} | sort | uniq | sed 's/^ *.host name/\host/' | sed 's/\/>//' | tr -d '"' | tr ' ' '=' | awk -F= '{print $2":"$4":"$6}' | while IFS=":" read host port count;
do
echo "host='$host' port='$port' count='$count'";
timeout 3 curl -k -s --data "action=getListNodes" https://$user:$password@$host:$port/grid/admin/WFServlet | python -m json.tool 2>/dev/null | grep 'remoteHost';
if [[ $? -ne 0 ]]; then
echo -e "!!! --- HUB $host:$port is unavailable --- !!! \n"
else
nod_num=`timeout 2 curl -k -s --data "action=getListNodes" https://$user:$password@$host:$port/grid/admin/WFServlet | python -m json.tool | grep -c 'remoteHost';`
if [[ ${nod_num} == ${count} ]]; then
echo -e "All nodes are running on hub ${host} \n"
else
echo -e "${nod_num} node(s) are running. Please check other nodes on hub ${host} or adjust quota file and restart rpa_manager service. Should be ${count} node(s) \n"
fi
fi
done
done
Below is a usage example (the first parameter is the name of the file from the quota or directory):
$ ./check_hub.sh users