Follow the procedure to upgrade the Remote Collector Manager from 2.3 or 2.3.1 to 2.4.0.

Prerequisites

  • These steps needs be executed only after upgrading VMware Telco Cloud Service Assurance from 2.3 or 2.3.1 to 2.4.0.
  • The harbor end point must point to the VMware Telco Cloud Service Assurance 2.4.0 repository.
Note: This procedure must be executed on all remote data centers.

Procedure

  1. Run the following command in the deployer host of the VMware Telco Cloud Service Assurance 2.4 setup to identify the harbor end point. Update the corresponding value in remote_env.properties file.
    kubectl get tcxproduct -o jsonpath='{.items[0].spec.globalSpec.registryRootUrl}' -n tcsa-system 
    
  2. Copy the upgrade_remote_collector.sh file from the VMware Telco Cloud Service Assurance bundle to same location of the base remote collector manager installation directory.
    /root/tcx-deployer/scripts/remoteCollectorManager/upgrade_remote_collector.sh
  3. Change the permission of the upgrade_remote_collector.sh file:
    chmod +X  upgrade_remote_collector.sh
  4. Update the variable ENV_PROPERTIES_FILE with the file path same as specified during the base remote collector manager installation in upgrade_remote_collector.sh.
  5. Execute the following command:
    bash upgrade_remote_collector.sh
    The following is an example of the upgrade_remote_collector.sh script.
    #!/bin/bash
     
    #Variables For Script
    #Modify the location of the ENV_PROPERTIES_FILE as per your system
    ENV_PROPERTIES_FILE=$(pwd)/remote_env.properties
    TLS_CERTIFICATE_PATH=$(pwd)/remote/certs
    CUSTOM_PACKAGE_PATH=$(pwd)/remote/custom_packages
    #please Donot change the Following variables
     
    NETWORK_NAME=internal-collector-network
    source $ENV_PROPERTIES_FILE
    TCSA_URL=https://$TCSA_IP:$TCSA_PORT
    echo "Get Remote Collector Manager Image from TCSA"
    access_token=$(curl -k --location --request POST $TCSA_URL/auth/realms/NGINX/protocol/openid-connect/token --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=password' --data-urlencode 'client_id=operation-ui' --data-urlencode 'username='$TCSA_USERNAME --data-urlencode 'password='$TCSA_PASSWORD | sed "s/{.\"access_token\":\"\([^\"]\).*}/\1/g")
     
    image_id=$(curl -k --header "Authorization: Bearer $access_token" $TCSA_URL/dcc/v1/remote/images |grep '"image"' | sed 's/.: "\(.\)".*/\1/')
     
    echo $image_id
    if [ -z "$image_id" ]
    then
       echo "Remote Collector manager Image is not available please make sure you have Entered correct TCSA_URL, TCSA_USERNAME and TCSA_PASSWORD";
       exit 1
    fi
     
    echo "Fetched the Remote Collector manager Image Name From TCSA done"
     
    echo "Create Internal Network if required"
    # Check if the network already exists
    if ! docker network inspect $NETWORK_NAME >/dev/null 2>&1; then
      # If the network doesn't exist, create it
      docker network create $NETWORK_NAME --driver bridge
    fi
     
    # checking if container already exists
    docker ps -a --filter "name=collector-manager" | grep "collector-manager" > /dev/null
    if [ $? -eq 0 ]; then
      echo  "Stopping existing Remote Collector Manager"
      docker rm -f filebeat-custom
      docker stop collector-manager
      echo "Removing Remote Collector Manager "
      docker rm -f collector-manager
    fi
    systemctl restart docker
    echo "creating the Remote Collector manager Container with latest image and Name : collector-manager"
    docker_id="$(docker run -d -p 443:443 -v /var/run/docker.sock:/var/run/docker.sock --env-file ${ENV_PROPERTIES_FILE} -e TCSA_PASSWORD=${TCSA_PASSWORD} -e REGISTRY_PASSWORD=${REGISTRY_PASSWORD} -v ${TLS_CERTIFICATE_PATH}:/etc/nginx/certs -v ${CUSTOM_PACKAGE_PATH}:/app/custom_packages --network internal-collector-network --restart unless-stopped --name collector-manager $image_id)"
    # check if container is up
    if [ $? -eq 0 ] ; then
       echo "collector-manager started successfully please check the logs using docker logs -f collector-manager"
    else
       echo "collector-manager failed to start please check logs docker logs collector-manager"
    fi