4 Replies Latest reply on Jun 5, 2015 1:36 PM by Bill Robinson

    Smart Group overcome operators limitation

    Mateusz Skrzynski

      Hi,

      I need to create Smart group which can select servers based on IP, FQDN etc

      BUT

      I need to be sure that all selected servers are either Windows or NonWindows:

      What will do the trick?


      What I have so far;

      SMART_GROUP_FOLDER='/AO_SmartGroups'
      SMART_GROUP_NAME='TemporaryServerGroup'
      SMART_GROUP_PATH="${SMART_GROUP_FOLDER}/${SMART_GROUP_NAME}"
      
      
      #Create Group with initial Criteria
      blcli_execute SmartServerGroup createGroup "${SMART_GROUP_FOLDER}" "${SMART_GROUP_NAME}"  'AoTempGroup' 'FQ_HOST' 'equals' "${SERVER_IDENTIFICATION}"
      
      #Add criteria to Smart Group
      blcli_execute SmartServerGroup addCondition "${SMART_GROUP_PATH}"  'NAME' 'equals' "${SERVER_IDENTIFICATION}"
      blcli_execute SmartServerGroup addCondition "${SMART_GROUP_PATH}"  'IP_ADDRESS' 'equals' "${SERVER_IDENTIFICATION}"
      blcli_execute SmartServerGroup addCondition "${SMART_GROUP_PATH}"  'HOST' 'equals' "${SERVER_IDENTIFICATION}"
      
      
      

      I'll get list of servers -> user will provide list of servers and I don't trust him .

      How to make sure that these are Windows or NonWindows.

      THX

        • 1. Re: Smart Group overcome operators limitation
          Mateusz Skrzynski

          Fixed:

          1. Create Static Server group

          2. List All servers in the SmartGroup and foreach check OS property and add it to static server group

           

          for ServerName in $SERVERS_LIST
          
          do
            blcli_execute Server printPropertyValue "${ServerName}" 'OS'
            blcli_storeenv ServerOS
          
            case ${OS} in
            "Windows")
            if [[ ${ServerOS} = ${OS} ]]
            then
            blcli_execute Server getServerIdByName "${ServerName}"
            blcli_storeenv ServerName_Id
            blcli_execute StaticServerGroup addServerToServerGroup "${STATIC_SERVER_GROUP_ID}" "${ServerName_Id}"
            fi
            ;;
            "")
            #Os empty
            blcli_execute Server getServerIdByName "${ServerName}"
            blcli_storeenv ServerName_Id
            blcli_execute StaticServerGroup addServerToServerGroup "${STATIC_SERVER_GROUP_ID}" "${ServerName_Id}"
            ;;
            *)
            #NonWindows
            if [[ ${ServerOS} != 'Windows' ]]
            then
            blcli_execute Server getServerIdByName "${ServerName}"
            blcli_storeenv ServerName_Id
            blcli_execute StaticServerGroup addServerToServerGroup "${STATIC_SERVER_GROUP_ID}" "${ServerName_Id}"
            fi
            esac
          
          done
          
          • 2. Re: Smart Group overcome operators limitation
            Bill Robinson

            why can't you make a smart group for this ?

             

            add a check for the OS property being Windows or not windows and set the match all ? 

            • 3. Re: Smart Group overcome operators limitation
              Mateusz Skrzynski

              Hi Bill,

              Idea here was to allow user to use IP, hostname or fqdn to find a server. User doesn't have access to BSA, he will use Atrium Orchestrator OCP. He will pas list of IPs, Fqdns or hostnames and based on his input Smartgroup will be created. So i need to use OR operator for criteria. (My first post)

              Then I want to ensure that he entered only Windows or non windows servers.

               

              I couldn't find relevant NSH command to group all OR conditions and then add AND ??OS?? condition.

               

              BR

              • 4. Re: Smart Group overcome operators limitation
                Bill Robinson

                so in 8.7 there should be a 'nested smart groups' feature which will help w/ this.  the other thing that would be nice is extending the complex conditions from compliance to the smart group queries.