3 Replies Latest reply on May 20, 2020 8:58 AM by Bill Robinson

    quickest way to group agents based on version under a static server group

    Parag Desai
      Share This:

      BSA 8903

      I have a static server group containing around 150 targets (not controlled by any server property). I need to create sub groups based on the agent versions as my deploy job is asset class version specific.

      I tried the below; however, it fails

       

      #!/bin/nsh

      GROUP="/Parent/staticgroup"

      blcli_execute Server listServersInGroup $GROUP

      blcli_storeenv SERVER_LIST

      for serverName in $SERVER_LIST

      do

      blcli_execute Server getFullyResolvedPropertyValue "$serverName" "AGENT_MINOR_VERSION*"

      blcli_storeenv MinorV

       

      if [ "$MinorV -eq "9" ]; then

      SERVER_GROUP="/Workspace/capam89"

      elsif [ "$MinorV -eq "7" ];

      SERVER_GROUP="/Workspace/capam87"

      else

      SERVER_GROUP="/Workspace/capam8x"

      fi

      blcli_execute ServerGroup  groupNameToId $SERVER_GROUP

      blcli_storeenv SERVER_GROUP_ID

      blcli_execute StaticServerGroup addServerToServerGroupByName $SERVER_GROUP_ID $serverName

      done

       

      Command execution failed. com.bladelogic.om.infra.session.client.SessionLoginException: java.lang.IllegalArgumentException: Cannot decode a string of length '29' since it is not a multiple of 64

      Exception in thread "main" java.lang.Exception: Error connecting to server -<jobserver>. Please check if BLCIServerService is up and running correctly. Error was Connection reset

      at com.bladelogic.om.infra.cli.CLIClient.executeEmbeddedShellCommand(CLIClient.java:276)

       

       

      Is there no blcli to Assign Server instead of Add? I think this adding is causing issue as the servers are already registered in BSA.

       

      Please suggest.

       

      Thanks,

      Parag

        • 1. Re: quickest way to group agents based on version under a static server group
          Bill Robinson

          i don't think the problem is w/ your command, it's w/ the input.  i'd cleanup the script a bit and at least echo out what server/group/id you are trying to use to make sure the input is ok.

           

          #!/bin/nsh

          GROUP="/Parent/staticgroup"

          blcli_execute Server listServersInGroup "${GROUP}"

          blcli_storeenv SERVER_LIST

          while read serverName

               do

              blcli_execute Server getFullyResolvedPropertyValue "$serverName" 'AGENT_MINOR_VERSION*

              blcli_storeenv MinorV

              if [[ "${MinorV} -eq "9" ]; then

                     SERVER_GROUP="/Workspace/capam89"

               elsif [ "${MinorV} -eq "7" ]; then

                         SERVER_GROUP="/Workspace/capam87"

               else

                   SERVER_GROUP="/Workspace/capam8x"

                fi

                blcli_execute ServerGroup  groupNameToId "${SERVER_GROUP}"

               blcli_storeenv SERVER_GROUP_ID

               echo "Assigning ${serverName} to ${SERVER_GROUP}:${SERVER_GROUP_ID}"

               blcli_execute StaticServerGroup addServerToServerGroupByName ${SERVER_GROUP_ID} "${serverName}"

          done <<< "$(awk 'NF' <<< "${SERVER_LIST}")"

           

          and what version of tssa is this ?

          1 of 1 people found this helpful
          • 2. Re: quickest way to group agents based on version under a static server group
            Parag Desai

            Thanks a lot Bill. It worked after making the above changes. By the way this is TSSA 8903.

            • 3. Re: quickest way to group agents based on version under a static server group
              Bill Robinson

              i believe one cause of that error w/ the blcli server enabled was due to either passing a windows eol character or a multiple line input to a command that wasn't expecting it, which is why i was betting it was the input.