1 2 Previous Next 21 Replies Latest reply on May 6, 2015 12:23 AM by Reinhard Vielhaber Branched from an earlier discussion.

    Re: Importing Servers with Server Properties



      Struggling to find any documentation that details example use cases of bulkSetServerProperties. We have a customer that would like to create a server group, or run a job against a list of targets that are uploaded through CSV. Can we use bulkSetServerProperties to create a server group inside BSA that includes the servers listed in the CSV?


      Many thanks


        • 1. Re: Importing Servers with Server Properties
          Bill Robinson

          bulkSetServerProperties reads a CSV file and it sets the property values for the properties and servers listed in the file.  it does not create groups, or run a job or anything else.  it just sets property values.


          if you want to run an existing job against a list of servers i would at the 'Job.executeAgainstServers' command which takes a comma separated list of servers.


          if there is some property that you can use to group the servers then you should create a smart group, and as servers' properties meet the conditions of the smart group they will show up in the group

          • 2. Re: Importing Servers with Server Properties
            Joe Piotrowski

            Is there a reason these servers need to be in a static Server Group? Like Bill suggested, is there another way these servers can be grouped together using a Smart Server Group?


            If need be you can create a new server property, import your servers and set that property to whatever value you want in the CSV file, and then leverage a Smart Server Group to list just those servers that have that property value.

            • 3. Re: Importing Servers with Server Properties

              Thanks Bill / Joe,


              We investigated whether there was criteria for creating smart groups but it seem that there isn't. Instead we're provided with a CSV file of hosts that need patching - and these lists can change weekly. The actual requirement is to be able to take the CSV and have a patch job run against the hosts listed so as to avoid the overhead of defining the hosts one by one in BSA.


              The 'Job.executeAgainstServers' command sounds like the way to go. Do we have any documentation around how this and similar commands can be used?


              Thanks again.

              • 4. Re: Importing Servers with Server Properties
                Rajeev Gupta

                From Console :


                1. Create a New Property or use an existing one.

                2. Set the property value of the CSV Listed servers as DDMMYYHHMMSS so that its s Unique Id.

                3. Use the same Unique id to create a SMART Group

                4. Create the patch job and deploy against servers in that smart group.



                Importing servers with Propery :


                Create a CSV as shown below :








                Where Server_Name = Name of the servers to be imported

                PROPERTY_NAME= Name of the property to be updated.


                Also, if you want some other property to be added, just add another with the exact property name

                ex :


                In case the servers are already added, use the blcli :

                Server bulkSetServerPropertyValues "/fileDir" "fileName"


                the format is like:












                From NSH:

                Get the JOB_KEY:

                blcli_execute PatchingJob getDBKeyByGroupAndName '$JOB_FOLDER' '$JOB_NAME'

                Then either :

                blcli_execute Job addTargetServers $JOB_KEY $TARGET_SERVERS_CSV


                blcli_execute Job executeAgainstServers $JOB_KEY target1,target2,target3...

                • 6. Re: Importing Servers with Server Properties
                  Rajeev,  Thanks so much for taking the time to break this down. We'll run through this next week.  Cheers!
                  • 7. Re: Importing Servers with Server Properties
                    Got it. Thanks Bill.
                    • 8. Re: Importing Servers with Server Properties
                      Mike Reider

                      Having an issue running this command, heres my script (running it directly from teh appserver)  (8.5.1)










                      blcli_execute Server bulkSetServerPropertyValuesAndLogResults "/tmp" "test.csv"





                      The nsh script job runs directly against the appserver, the csv exists on the appserver in /tmp dir

                      the csv file exists:



                      [root@ulvblgp01 tmp]# cat /tmp/test.csv



                      Getting this error during job run


                      Error05/04/2015 18:05:36Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: java.io.FileNotFoundException: /tmp/test.csv (No such file or directory)
                      • 9. Re: Importing Servers with Server Properties
                        Bill Robinson

                        this is a type 1 nsh job ?  try putting a cd //@/ before the blcli_execute.

                        • 10. Re: Importing Servers with Server Properties
                          Reinhard Vielhaber

                          In addition to Bill's proposal to find the right file one should be aware, that the appserver - at first - searches files given by an absolut or relative path in ist own filesystem.


                          A file without any path is searched for (or written to in case you do something like redirection of the output) in the "$INSTALL_DIR/NSH/br"-Directory of the appserver itself.

                          • 11. Re: Importing Servers with Server Properties
                            Mike Reider

                            the job is "Execute the script separately against each host using runscript"


                            tried putting //@/ before blcli, still same error,


                            tried copying csv to /opt/bmc/bladelogic/NSH/br/tmp


                            same error msg. How do I make it see the file?




                            cd //@/

                            blcli_execute Server bulkSetServerPropertyValues $PATH $FILE


                            The blcli documentation also does not mention the path being relative to INSTALL_DIR

                            • 12. Re: Importing Servers with Server Properties
                              Bill Robinson

                              ok, so does the file exist on the appserver running the job, in /tmp ?


                              when you do runscript, the job will first cd to the target server, then run the script.  so your path will be //target.  the blcli command here can only use local paths and will not traverse nsh paths.  so if you cd back to the appserver (cd //@/) and then specify a path that's local to the appserver that contains the file the blcli should be able to find it.


                              let's see what is happening during the job run:


                              (not a good idea to use PATH as a variable here)




                              cd //@/


                              ls -la "${DIRPATH}/${FILE}"

                              if -f [[ "${DIRPATH}/${FILE}" ]]


                              blcli_execute Server bulkSetServerPropertyValues "${DIRPATH}" "${FILE}"


                              echo "Cannot find ${DIRPATH}/${FILE}"

                              exit 1


                              • 13. Re: Importing Servers with Server Properties
                                Mike Reider

                                Hi Bill, getting this output


                                Info05/05/2015 10:29:32Exit Code 1
                                Info05/05/2015 10:29:32Cannot find /tmp/file2.csv
                                Info05/05/2015 10:29:32/
                                Error05/05/2015 10:29:31ls: /tmp/file2.csv: No such file or directory
                                Info05/05/2015 10:29:31//ulvblgp01/




                                the csv file is in /tmp on the appserver



                                [root@ulvblgp01 tmp]# cat file2.csv


                                [root@ulvblgp01 tmp]#

                                • 14. Re: Importing Servers with Server Properties
                                  Bill Robinson

                                  what are the permissions on 'file2.csv' ?  can the bladmin os user read it ?

                                  1 2 Previous Next