Before upgraded the ALL (or individually) SCS service instances it it recommended to verify ALl service instances to be in a good state. Cleanup any failed instances.
The script provides a report of the following fields.
Sample output:
$ /tmp/scs_si_state.sh=============================================================Spring Cloud Services Instances - Wed Mar 19 06:53:47 MDT 2025-------------------SI GUID -- 1111111-2222-3333-55555555SERVICE NAME - "myservice-registry"SPACE - "myspace"ORG - "bsamson"STATUS - "failed"DASHBOARD_URL- "https://service-registry-.apps-example.com/dashboard"1111111-2222-3333-55555555Routes - service-registry-.example.com1111111-2222-3333-55555555-------------------SI GUID -- 1111111-2222-3333-444444444SERVICE NAME - "myconfig"SPACE - "myspace"ORG - "myorg"STATUS - "succeeded"DASHBOARD_URL- "https://config-server-1111111-2222-3333-444444444.apps-example.com/dashboard"Routes - config-server-1111111-2222-3333-444444444.apps.example.com
The report can be used to:
cat <<'EOF' > /tmp/scs_si_state.sh
#!/bin/sh
# PREREQUISITES
# - User must be logged in with UAA admin credentials before executing this script.
# cf login -a api.system-domain
#
DATE=`date`
echo "============================================================="
echo "Spring Cloud Services Instances - $DATE"
#echo "============================================================="
export ORG='p-spring-cloud-services'
cf t -o $ORG > /dev/null 2>&1
cf spaces |
while read SPACE
do
STR_LENGTH=`echo $SPACE | wc -c`
if [ $STR_LENGTH -eq 37 ]
then
SI_CURL=`cf curl /v2/service_instances/$SPACE`
SERVICE_NAME=`echo $SI_CURL | jq '.entity.name'`
LAST_OPERATION_STATUS=`echo $SI_CURL | jq '.entity.last_operation.state'`
DASHBOARD_URL=`echo $SI_CURL | jq '.entity.dashboard_url'`
SPACE_URL=`echo $SI_CURL | jq '.entity.space_url' | sed -e 's/^"//' -e 's/"$//' `
# echo "SPACE_URL -- $SPACE_URL"
SPACE_CURL=`cf curl $SPACE_URL`
# echo "ORG-CURL -- $SPACE_CURL"
ORG_URL=`echo $SPACE_CURL| jq '.entity.organization_url' | sed -e 's/^"//' -e 's/"$//' `
# echo "ORG_URL -- $ORG_URL"
ORG_CURL=`cf curl $ORG_URL`
SPACE_NAME=`echo $SPACE_CURL | jq '.entity.name'`
ORG_NAME=`echo $ORG_CURL | jq '.entity.name'`
#echo "============================"
cf t -s $SPACE > /dev/null 2>&1
echo "-------------------"
echo "SI GUID -- $SPACE"
echo "SERVICE NAME - $SERVICE_NAME"
echo "SPACE - $SPACE_NAME"
echo "ORG - $ORG_NAME"
echo "STATUS - $LAST_OPERATION_STATUS"
echo "DASHBOARD_URL- $DASHBOARD_URL"
cf apps |
while read APP
do
if [[ $APP =~ "config-server" ]] || [[ $APP =~ "service-registry" ]]
then
ROUTE=`echo $APP | cut -d" " -f4`
echo "Routes - $ROUTE"
fi
done
fi
done
EOF