4 Replies Latest reply on Sep 18, 2015 7:21 AM by Bill Robinson

    performing multiple action using 1 blcli_execute command

    James Donohue

      Hi,

      Is there a method where I can use 1 blcli_execute command to perform multiple operations in a timely manner? This is only a small part of my (type 2)script:

      OS=`blcli_execute Server getFullyResolvedPropertyValue ${server} OS`

      NETWORK_ADDRESS=`blcli_execute Server getFullyResolvedPropertyValue ${server} NETWORK_ADDRESS`

      RSCD_VERSION=`blcli_execute Server getFullyResolvedPropertyValue ${server} RSCD_VERSION`

      AGENT_STATUS=`blcli_execute Server getFullyResolvedPropertyValue ${server} AGENT_STATUS`

       

      Now I obviously don't know all that much about using blcli / NSH since I just really started gaining momentum about a month ago but my guess is that this may not be a very efficient way to get these properties; one at a time. I'm running this script and obtaining about 6 Server property values, doing a ping function and saving to a CSV file and emailing it. I'm running it against 244 Servers and so far its taken 3.5 hours and if my calculations are correct it's taking approx. 1 minute and 20 seconds per Server which means it could take 5.4 hours to complete!. What will happen if I run this script against 500, 1000 Servers?

       

      How can speed this script up to an acceptable duration?  Any advice is appreciated. 

        • 1. Re: performing multiple action using 1 blcli_execute command
          Bill Robinson

          1 - Stop doing this:

          FOO=`blcli_execute`.

          instead do

          blcli_execute xxx

          blcli_storeenv FOO

          when you do the assignment like FOO=`xxx` you are spawning another jvm for the spawned process which negates the purpose of the 'performance commands' (blcli_execute) which is to avoid spawning additional jvms for each blcli command which takes additional time and resources on the appserver.

           

          2 - if you are trying to get a number of server properties, there is a Server getBulkServerPropertyValuesAndLogResults which will let you get multiple property values for multiple servers at once.

           

          3 - why do you need these properties ?  why not use bdssa? or pass them as arguments into the script and write them directly ?

          • 2. Re: performing multiple action using 1 blcli_execute command
            James Donohue

            1 - Ok, I will stop creating assignments and use the blcli commands directly. I guess I'm not used to that but will now get used to it.

             

            2 - I will look at that but not sure I can use it

             

            3-I can't depend on the Team that does BDSSA reporting right now and they're not providing access for me to do things myself. We're currently negotiating. This is for a "Newly Enrolled Servers - Status Report", that I'll be sending out twice per week so I need to collect these values for every Server that has been recently enrolled and provide them to the Server owners so they can re-mediate when/if there's any issues discovered.

            • 3. Re: performing multiple action using 1 blcli_execute command
              James Donohue

              Already down from 1 minute 20 seconds to just 29 seconds per Server. Thanks Bill!

              • 4. Re: performing multiple action using 1 blcli_execute command
                Bill Robinson

                you should look at the bulk export if you aren't already - you would build the list of servers/properties in a loop (since it's a type 2), write out that file and then run the command, so like:

                 

                serverList=${@}

                inputFile=/tmp/$$.csv

                 

                for server in ${serverList}

                do

                echo "${server},OS" >> "${inputFile}"

                echo "${server},NETWORK_ADDRESS" >> "${inputFile}"

                echo "${server},RSCD_VERSION" >> "${inputFile}"

                done

                 

                blcli_execute Server getBulkServerPropertyValuesAndLogResults "${inputFile}"

                 

                blcli_execute Email sendMailWithAttachment from@foo.com to@foo.com "New Server Report" "New Server Report" "${inputFile%/*}" "${${inputFile##*/}%/*}_result.csv"