1 2 Previous Next 21 Replies Latest reply on Apr 9, 2015 9:29 AM by Olivier Renault

    Get all Server Properties

    Iain Taylor

      Hi is there a blcli command or some form of script that could be used to run against all servers in an environment and get all its properties then output them to a csv? or is it something that would a db query, and if so do  you know which table and the sql statment that would be needed

       

      I have tried the command Server PrintAllProperties "hostName" but although that outputs to the screen I am unable to output it to a file.

       

      Many thanks

        • 1. Re: Get all Server Properties

          Hi,

          This is a really old thread but you might find something you can use in there.

           

          https://communities.bmc.com/communities/message/127186#127186

          • 2. Re: Get all Server Properties
            Iain Taylor

            Hi, thanks for the link, I saw this one before i posted, but I dont think it actually does what I am after! we are migrating across from one environment to another, and we will have to bulk import the servers in from a csv, what I would like to do is add the properties in at time of import, which means that I need to be able to get all the properties from the server prior to doing a bulk import.

             

            as I say the Server printAllProperties command outputs the properties, but there is no way of outputting it to a file or is there?

            • 3. Re: Get all Server Properties

              Hi Iain,

               

              This may help - it's an extract of a script I used to export all users to file:

               

              blcli_execute RBACUser getAllUserNames

              blcli_storeenv ALL_RBAC_USERS

              echo $ALL_RBAC_USERS >> ./bluserlist$DATE_TODAY-$UNIQUE

               

              You can definitely print things to file this way, but I'm not sure what the formatting of printAllProperties would be, or if you could force it into a CSV format with your output... Good luck!

              • 4. Re: Get all Server Properties

                Actually, this might help even more... You could use the first blcli command to list all servers then iterate through them in the loop, printing all of their properties?

                 

                 

                # Stores all usersnames from the role in a variable

                 

                 

                blcli_execute RBACUser getAllUserNamesByRole $ROLE_NAME

                blcli_storeenv USERS_IN_ROLE

                 

                 

                # Gets DESCRIPTION for all users in the variable

                 

                 

                for user in $USERS_IN_ROLE

                do

                          blcli_execute RBACUser getFullyResolvedPropertyValue $user DESCRIPTION

                          blcli_storeenv USER_DESCRIPTION

                          echo "$USER_DESCRIPTION\n" >> users-$ROLE_NAME-$DATE_TODAY-$UNIQUE.txt

                done

                1 of 1 people found this helpful
                • 5. Re: Get all Server Properties

                  here's the basic idea, you can tweak it how you like

                   

                  blcli_execute Server listAllServers
                  blcli_storeenv SERVER_LIST

                   

                  for serverName in $SERVER_LIST
                  do
                       echo "Properties for server $serverName" >> output.file
                       blcli_execute Server printAllProperties $serverName
                       blcli_storeenv SERVER_PROPERTIES
                       echo "$SERVER_PROPERTIES" >> output.file
                  done

                   

                   

                  edit: blcli_store_env > blcli_storeenv

                  • 6. Re: Get all Server Properties
                    Iain Taylor

                    Lazar, perfect thank you, that worked a treat, the only thing I had to change was the store enivroment variable option

                     

                    eg blcli_storeenv ..... rather than blcli_store_env

                     

                    example of script

                     

                     

                    #!/bin/nsh

                     

                    blcli_execute Server listAllServers

                    blcli_storeenv SERVER_LIST

                    for serverName in $SERVER_LIST

                    do

                         echo "Properties for server $serverName >> output.txt

                         blcli_execute Server printAllProperties $serverName

                         blcli_storeenv SERVER_PROPERTIES

                         echo "$SERVER_PROPERTIES >>output.txt

                    done

                    • 7. Re: Get all Server Properties
                      Bill Robinson

                      why do you need to do this ?

                      • 8. Re: Get all Server Properties
                        Iain Taylor

                        Hi Bill, I am working on a project where we have a brand new 8.2 enviroment built that is going to be the new production environment, the current production enviroment is 7.4, which we have replicated and has been upgraded to 8.2 also.

                        What is wanted is a list of all servers with their properties that we can use to populate a csv so we can import it into the new and seperate 8.2 environment.

                         

                        Not all the properties are going to be used in the new environment but 75% of the data needed to populate the required properties is already present in the old environment so the plan was to export it to a file and then manipulate the data to create the server import csv.

                         

                        At present there is no reports server so I cant create a custom report that would do this for us, this was the one of the ways that I could think of that we could get the data other than having to do a db query to extract the data.

                         

                        Is there another way you can think of doing it?

                        • 9. Re: Get all Server Properties
                          Bill Robinson

                          how many servers do you have in the old env?

                           

                          why can't you upgrade to 8.2 instead of a clean install?

                           

                          i was going to say use reports but you don't have that.

                          • 10. Re: Get all Server Properties
                            Iain Taylor

                            Hi Bill, there are currently about 2300 servers in the environment.

                             

                             

                            The reason we cant do an upgrade is because there has been an merging of departments etc so there is a large amount of redundant processes/jobs/smartgroups etc in the current environment. they want a clean start with there will be jobs/scripts etc that will be exported/imported so as not to have to recreate them entirely, but we are also doing a cleanup of the properties as again a large number of them are to become redundant, which will also speed up the environment.

                            • 11. Re: Get all Server Properties
                              Bill Robinson

                              if you are doing a one-time load, that's probably the best bet.

                              • 12. Re: Get all Server Properties
                                Robert Rudolph

                                Hi,  i was wondering if lain ever got this to work and what the final script looked like.  I am in the same situation, having to do a one time load.  I was experimenting with this script as shown in this thread....

                                 

                                #!/bin/nsh

                                 

                                blcli_execute Server listAllServers

                                blcli_storeenv SERVER_LIST

                                 

                                for serverName in $SERVER_LIST

                                do

                                     echo "Properties for server $serverName >> output.txt

                                     blcli_execute Server printAllProperties $serverName

                                     blcli_storeenv SERVER_PROPERTIES

                                     echo "$SERVER_PROPERTIES >>output.txt

                                done

                                 

                                The server name can easily be listed in the script also (using echo $serverName).  This works, but the output has all the properties in the first column of the csv.  And we need to get the output to look like this:

                                 

                                server1, propertyvalue1, propertyvalue2, propertyvalue3...  (etc. to list all properties...)

                                server2, propertyvalue1, propertyvalue2, propertyvalue3...

                                server3, propertyvalue1, propertyvalue2, propertyvalue3...

                                 

                                Any help is appreciated!

                                • 13. Re: Get all Server Properties
                                  Iain Taylor

                                  Hi Robert, this was my final script:

                                   

                                   

                                  #!/bin/nsh

                                   

                                  blcli_execute Server listAllServers

                                  blcil_storenv SERVER_LIST

                                   

                                  for serverName in $SERVER_LIST

                                   

                                   

                                  do

                                   

                                  blcli_execute Server printAllProperties $serverName  blcli_storeenv SERVER_PROPERTIES

                                  echo "$SERVER_PROPERTIES" >> //BLCORE/C/tmp/serverlist.csv 

                                   

                                  done

                                   

                                  ############################################################################

                                   

                                   

                                   

                                   

                                  output looked like this:

                                  Properties for server BLCORE

                                  BYPASS_TRAVERS_CHECKING , ??DISA Windows SecurityProperties.BYPASS_TRAVERS_CHECKING??

                                  OS_PLATFORM , x86

                                  REPEATER_MAX_CACHE_SIZE , 0

                                  ANTIVIRUS , McAfee VirusScan Enterprise

                                  etc.......

                                  I had to get someone to use a db application to manipulate the data so that the headings were presented as the column headers but it worked in the end and we are able to use it to create a csv to get the property data we needed for the new import.csv.

                                   

                                  1 of 1 people found this helpful
                                  • 14. Re: Get all Server Properties
                                    Bill Robinson

                                    there's an unreleased command called 'Server.findAllPropertiesForAllServers' that you could call like:

                                     

                                    blcli_execute Server findAllPropertiesForAllServers

                                    blcli_execute Utility mapPrint

                                     

                                    and they try and text process that.

                                    1 2 Previous Next