3 Replies Latest reply on May 14, 2018 3:08 PM by Bill Robinson

    blcli_execute question

    Gary Jarrell

      With the help of the community, I was able to create a job to add a server and move it to a group.


      It was suggested it use blcli_execute and other commands to make it more efficient.

      When I run blcli_execute or blcli_setoption I get command not found.


      I am running Client version


      I am also trying to get it to validate a server, so it will be changed from a basic host to a Linux host.


      # Script to add a server to BladeLogic

      # Requirements -

      # BMC Blade Logic installed on PC or Linux box

      # Refer to for configuration <internal url>

      # a list of hosts, I use bl.txt.  You can change it whatever you want, but update script in the for loop.

      # This script was created in Babun, and will run under a pc with babun installed.

      # We will probably need to tweak for Linux.


      # Set Server Group


      # Get Server Group ID

      SERVER_GROUP1_ID=`blcli -v <servername> -r <role> ServerGroup groupNameToId $SERVER_GROUP1`

      # Add Server to BladeLogic

      for i in `cat ~/bl/bl.txt`; do

              SERVER1_NAME=`echo $i`

              echo "Adding server : " $SERVER1_NAME

              blcli -v <servername> -r <role> Server addServerIfIPUnique $SERVER1_NAME $SERVER1_NAME false

      # get the serverid

              echo "Getting serverid"

              SERVER1_ID=`blcli -v <servername> -r <role> Server getServerIdByName $SERVER1_NAME`

      # Now add the server to the group

              echo "Add Server to Group"

              blcli -v <servername> -r <role> StaticServerGroup addServerToServerGroup $SERVER_GROUP1_ID $SERVER1_ID

              echo "\n"

              sleep 5

      # Verify

              echo "Verify server"

              blcli -v <servername> -r <role> Utility updateServersStatus $SERVER1_NAME 2 12000 true

              echo "\n"