Another Automation script which does OEM13c Agent installation & configure EM CLI to OMS using shell script. How does it works?

  1. OEM has advanced their process by using emctl get_agentimage  it download agent image shell script onto server and does everything for you.
    emcli get_agentimage -destination=/u01/agent_software -platform=”Linux x86-64″ -version=”13.2.0.0.0″ 
  2. List support platforms that are in the repository.
dbadeeds:/>
oracle:OMSH $ emcli get_supported_platforms
-----------------------------------------------
Version = 13.2.0.0.0
 Platform = Linux x86-64
-----------------------------------------------
Version = 13.1.0.0.0
 Platform = IBM AIX on POWER Systems (64-bit)
-----------------------------------------------
Version = 13.2.0.0.0
 Platform = Microsoft Windows x64 (64-bit)
-----------------------------------------------
Version = 13.2.0.0.0
 Platform = Oracle Solaris on x86-64 (64-bit)
-----------------------------------------------
Version = 13.2.0.0.0
 Platform = IBM AIX on POWER Systems (64-bit)
-----------------------------------------------
Platforms list displayed successfully.

For suppose if you didn’t see your platform software then login to OEM –> setup–>plugins–>self-update–>Agent–>Click download.

3. Set your JAVA_HOME environment variable. You must be running Oracle (Sun) Java JRE 1.7.0_131 or greater. For example:

  • Using setenv (Linux platform):
    • setenv JAVA_HOME /usr/local/packages/jre 
 dbadeeds:/> oracle:emcli 
./emagent_emcli.ksh
#!/bin/ksh
set -e
#Title:Install 13cAgent, Set up EMCLI interface 
#Author: Sandeep R Narani
##
#Title:emagent_emcli.ksh
#Author: Sandeep R Narani
#Date:11/10/2017
####### Command Usage ./emagent_emcli.ksh 
sysman_pwd=${1}
###Keep you OMS URL here####
export EMCLI_PROD_OMS_URL=https://dbadeeds.systems.com/em
export EMCLI_USERNAME=sysman
### Hide you sysman password with base64 encryption format###
export PPWD=`echo "sdhsdbcbkjsd" | openssl enc -base64 -d`
export EMCLI_AUTOLOGIN=true
export AGENT_BASE_DIR=/u01/app/oracle/product/13.2.0.0/oem13c
export EMCLI_DIR=/u01/app/oracle/product/13.2.0.0/emcli
export EMCLI_TRUSTALL=true
TIMESTAMP=`date +%Y%m%d%H%M`
hostn=`hostname`
LOGFILE="/u01/app/oracle/platform/emcli/log/EMAGENT_EMCLI_${hostn}_${TIMESTAMP}"
					###############Requires Java version 1.7.0_80 or greater ##############################
export JAVA_HOME=/bin/java
export PATH=$JAVA_HOME/bin:$PATH

    print "You are Installation for Production" >> $LOGFILE
    print "Create the directories for agent & emcli" >> $LOGFILE
    mkdir -p /u01/app/oracle/product/13.2.0.0/oem13c >> $LOGFILE
	mkdir -p /u01/app/oracle/product/13.2.0.0/emcli >> $LOGFILE
					#################### EM AGENT Install Supported: Linux x86-64 only ###################################
	cd $AGENT_BASE_DIR
	curl "https://$EMCLI_PROD_OMS_URL/install/getAgentImage" --insecure -o $AGENT_BASE_DIR/AgentPull.sh >> $LOGFILE
	chmod 775 AgentPull.sh
	./AgentPull.sh LOGIN_USER=sysman LOGIN_PASSWORD=$sysman_pwd PLATFORM="Linux x86-64" AGENT_REGISTRATION_PASSWORD=$sysman_pwd AGENT_BASE_DIR=$AGENT_BASE_DIR >> $LOGFILE
					################### Check Agent Status & Upload #################
	$AGENT_BASE_DIR/agent_inst/bin/emctl status agent >> $LOGFILE
	sleep 3m
	$AGENT_BASE_DIR/agent_inst/bin/emctl upload agent >> $LOGFILE
	sleep 3m
	$AGENT_BASE_DIR/agent_inst/bin/emctl status agent >> $LOGFILE
	echo 'PROD_OEM Agent Installation Completeled Successfully' >> $LOGFILE
			#########################   EMCLI[Command Line Interface] Install  Requires Java version 1.7.0_80 or greater | Supported: Linux ##############################
	echo 'EMCLI installing  & Configuring to Prod_OEM' >> $LOGFILE
	cd $EMCLI_DIR
	curl "https://$EMCLI_PROD_OMS_URL/public_lib_download/emcli/kit/emcliadvancedkit.jar" --insecure -o $EMCLI_DIR/emcliadvancedkit.jar >> $LOGFILE
	$JAVA_HOME -jar $EMCLI_DIR/emcliadvancedkit.jar client -install_dir=$EMCLI_DIR >> $LOGFILE
	$EMCLI_DIR/emcli setup -url=$EMCLI_PROD_OMS_URL -username=sysman -password=$sysman_pwd -trustall >> $LOGFILE
	$EMCLI_DIR/emcli sync -url=$EMCLI_PROD_OMS_URL -username=sysman -password=$sysman_pwd -trustall >> $LOGFILE
	echo 'EMCLI Installed Successfully' >> $LOGFILE
	/bin/mailx -s "`hostname` -- SoE_Agent_Installation_Status" text@gmail.com < $LOGFILE

############################## Emcli Discover, promote and set the LifeCycle & Department groups to it ###########################
##################### Sleep at least 7-15 Mins to discover the databases to OEM based on UPload time #################
#######/bin/perl discover_promote.pl hostname SID LifeCycle Department 

 

Leave a comment