IBM Licence Metric Tools agent Instalation Automation for AIX and Linux

Hello Guys

Below script installs and verifys the IBM Licence Metric Tools on Linux and AIX

Prequsits for this script

1) Password less authentication / Password authentication for the destination server where you want to install the Agent
2) yum repo configured for Linux clients


Hear is the script


 #!/bin/ksh


#

# This script was designed to install Tivoli agent

#

# Written Sreekar Peddi 5/6/13



Filepath="/local/home/speddi02"

FileName="ILMT-TAD4D-agent-7.5.0-shell-all.tar.gz"

Installcmd="ksh"

datef=`date '+%d-%m'`

datefile="ILMT$datef"



if [ "$1" == "" ]; then

echo " Please provide the File contains list of servers \n"

exit

fi



lppcmd="lslpp -L ILMT-TAD4D-agent
grep ILMT-TAD4D-agent"

agentbin="ILMT-TAD4D-agent-7.5-aix-ppc.bin"

serverName="$1"



# Server Name Check



if [ $serverName = " " ] ; then



printf " Please Provide the server name \n"

exit

fi



cmd="ssh -qn $serverName"



OS=$( $cmd "uname" )



if [ "$OS" == "AIX" ] ; then



lppcmd="lslpp -L ILMT-TAD4D-agent
grep ILMT-TAD4D-agent"

agentbin="ILMT-TAD4D-agent-7.5-aix-ppc.bin"

fi



if [ "$OS" == "Linux" ] ; then

#Need to check arch if it is linux

arc=$($cmd "/usr/bin/lscpu
egrep 'Architecture'" )

arc1=$(echo $arc
awk '{print $2}'
cut -d'_' -f1)

#echo "Archi $arc1"

agentbin="ILMT-TAD4D-agent-7.5-linux-$arc1.bin"

lppcmd="rpm -qa
grep -i ilmt"

fi











# check if the ITLM agent is already installed on the server



checkAgent()

{

lppres=$($cmd $lppcmd 2>&1)

if [ "$OS" == "AIX" ] ; then

tst=$(echo $lppres
egrep 'not installed' )

if [ "$tst" == "" ] ; then



#echo " The file set is Installed on the server $serverName "

echo "yes"

else



#echo " The file set is Not installed"

echo "not"

fi





else

tst=$(echo $lppres)



if [ "$tst" == "" ] ; then



#echo " The file set is Installed on the server $serverName "

echo "not"

else



#echo " The file set is Not installed"

echo "yes"

fi



fi





}





agent=$(checkAgent)



#echo " Test Result : $agent"





if [ "$agent" == "yes" ] ; then



echo " The Agent is installed on the server $serverName"



else

echo " The file set is not installed $serverName"

echo " Now I am coping the File required to the $serverName to install the agent ........... "

echo " Please wait .."



ssh -qn $serverName "mkdir /tmp/$datefile"

scp $Filepath/$FileName $serverName:/tmp/$datefile > /dev/null 2>$1

if [ $? -eq 0 ] ; then

echo " File copied to $serverName now I am Installing......."

echo " Extracting the tar files ......."

ssh -qn $serverName "cd /tmp/$datefile;gunzip < /tmp/$datefile/$FileName
tar xvf - "

if [ $? -eq 0 ] ; then

echo " Files Exttracted ......"

echo " Installing Agent ......"

ssh -qn $serverName "ksh /tmp/$datefile/$agentbin -install"

if [ $? -eq 0 ] ; then

echo " Verifing agent Instalation please Wait......"

agve=$(checkAgent)

#echo " agve val : $agve"

if [ "$agve" == "yes" ] ; then

echo " The agent is Installed successfully..."

else

echo " The agent is not isntalled , please login server $serverName and verify"

fi



else

echo " The agent is not isntalled , please login server $serverName and verify"

fi



else

echo " Files NOT Extracted there is some problem .."

fi

else

echo " There is some problem in coping the file, exiting....."

exit

fi



fi

ADD this Info

Bookmark and Share