5 Replies Latest reply on Mar 15, 2016 6:25 PM by Bill Robinson

    How can I add a server link group by server in listServersInGroup ( ls //Group/host)

    Pat Campbell

      Something similar to this but, I want to add

      groups link "CentOS5", "CentOS6", etc built from smart groups.

      Detecting non-Redhat Groups seems to be a problem, at least for me.

      HostInGroup=`/usr/local/nsh/br/blcli  Server listServersInGroup /UnixAdmins/Servers\ by\ OS/$group/$groupName`

       

          for HOST in $HostInGroup

          do

              ln -s //$HOST $HOST

          done

        • 1. Re: How can I add a server link group by server in listServersInGroup ( ls //Group/host)
          Bill Robinson

          what is a 'server link group' ?

           

          what do you mean 'detecting non-Redhat groups' ?  are you trying to look at the conditions in existing smart group?  or find centos servers in a certain server group ?

           

          what exactly do you hope to accomplish by create a symlink to a server (and where?)?

          • 2. Re: How can I add a server link group by server in listServersInGroup ( ls //Group/host)
            Pat Campbell

            We are running 7.4.4

            What we currently have, that we are having trouble figuring out how it

            was implemented year ago is...

             

            on the Configuration Manager

             

            //host

            /BL/AIX

            /BL/AIX5.2

            /BL/AIX5.3

            /BL/AIX6.1

            /BL/AIX7.1

            /BL/RHEL5

            /BL/RHEL6

            /BL/RHEL7

            /BL/Solaris

            /BL/Solaris10

            etc

             

            What I would also like to populate is

            /BL/CentOS5

            /BL/CentOS6

            etc

             

                • The script is ***

             

            group=$1

            DESTDIR=BL

            #

            1. Change directory to the appserver

            cd //stlpr332

            if

            then

            echo "Could not change directory to //stlpr332"

            exit 2

            fi

             

            CHILDGROUPS=`/usr/local/nsh/br/blcli ServerGroup listChildGroupsInGroup

            /UnixAdmins/Servers by OS/$group | awk '{print $1" "$2}'`

             

            #

            for groupName in $CHILDGROUPS

            do

            stripgroupName=`echo $groupName | sed 's/ //g'`

            if

            then

            mkdir /$DESTDIR/$stripgroupName

            if

            then

            echo "Cannot create directory /$DESTDIR/$stripgroupName"

            exit 3

            fi

            fi

            cd /$DESTDIR/$stripgroupName

            if

            then

            echo "Cannot change directory to /$DESTDIR/$stripgroupName"

            echo 3

            fi

             

            1. Clean out old hosts

            PWDIR=`pwd`

            if [ $PWDIR="//stlpr332/$DESTDIR/$stripgroupName" ]

            then

            echo "Removing `ls`"

            rm *

            if 

            then

            echo "Could not remove links"

            fi

            fi

            HostInGroup=`/usr/local/nsh/br/blcli Server listServersInGroup

            /UnixAdmins/Servers by OS/$group/$groupName`

             

            for HOST in $HostInGroup

            do

            ln -s //$HOST $HOST

            done

            done

             

            The groups shown as $groupName, which would be the CentOSxxx is what I

            need help building

             

            I think I need to have a server property that is reading

            /etc/redhat-release for the appropriate infomation, or update what is

            pulling that info to also understand CentOS.

             

            On 2016-03-15 14:00, Bill Robinson wrote:

             

            BMC COMMUNITIES

             

            HOW CAN I ADD A SERVER LINK GROUP BY SERVER IN LISTSERVERSINGROUP ( LS //GROUP/HOST)

             

            reply from Bill Robinson  in Server Automation - View the full discussion

             

            • 3. Re: How can I add a server link group by server in listServersInGroup ( ls //Group/host)
              Bill Robinson

              ok, so it looks like you have a script that makes a directory structure of symlinks to particular hosts based on group membership. 

               

              so it seems like you just need to make the smart group for your centos 6 boxes and then the script should do what it does.

               

              in 8.3+ centos will show up in the OS_VENDOR and OS_VERSION properties.  I doubt it will do that in 7.4.  i think it may show as UNKNOWN.  now, if all your non-rhel/sles/etc boxes are CentOS you might be able to create conditions like OS_RELEASE starts with 2.6 and OS_VERSION = unknown or something like that.

              • 4. Re: How can I add a server link group by server in listServersInGroup ( ls //Group/host)
                Pat Campbell

                Thanks for the info, I think

                 

                OS_VENDOR contains UNKNOWN

                and

                OS_VERSION contains el5 or el6 or el7 will give me what I need for

                splitting up the CentOS installs

                 

                On 2016-03-15 15:09, Bill Robinson wrote:

                 

                BMC COMMUNITIES

                 

                HOW CAN I ADD A SERVER LINK GROUP BY SERVER IN LISTSERVERSINGROUP ( LS //GROUP/HOST)

                 

                reply from Bill Robinson  in Server Automation - View the full discussion

                 

                • 5. Re: How can I add a server link group by server in listServersInGroup ( ls //Group/host)
                  Bill Robinson

                  ?yeah - that should work - os_version contains el5 and os_vendor = unknown is centos5

                   

                  (well, it might be redhat workstation too...)