Martins Blog

Trying to explain complex things in simple terms

Installing OEM 12c agents in RPM format

Posted by Martin Bach on November 22, 2011

One of the questions I have always asked myself revolved around: “why doesn’t Oracle package certain software as an RPM on Linux?” Well this question has recently been answered in the form of the Oracle 12c agent. It IS possible to use an RPM based installation, although it doesn’t make 100 use of RPM. I have written this post to give you an idea what happens.

The procedure is described in the OEM 12 Cloud Control Advanced Installation and Configuration Guide, chapter 6. The process is very similar to the non-RPM based agent deployment. Let’s have a loot at it in detail.

Operations to be performed on the OMS

Log in to the OMS host and log in to OEM using emcli as shown in these exapmles (which are taken from the official Cloud Control documentation):

[oracle@oem12oms ~]$ emcli login -username=sysman
Enter password :

Login successful

[oracle@oem12oms ~]$ emcli sync
Synchronized successfully

You can of course log in with a different username, appropriate permissions assumed. The next step is to get the agent image. If you would like to enquire which agents are staged on the OMS, use the following query:

[oracle@oem12oms ~]$ emcli get_supported_platforms
Getting list of platforms ...
Check the logs at /home/oracle/agent.log
About to access self-update code path to retrieve the platforms list..
Getting Platforms list  ...
-----------------------------------------------
Version = 12.1.0.1.0
Platform = Linux x86-64
-----------------------------------------------
Platforms list displayed successfully.

I installed OEM as Linux 64 bit, and it comes with the 64bit agent out of the box. You have to use self-update either in online or offline mode to add additional agents (when they become available). Now let’s get the RPM. The documentation states you have to use emcli get_agentimage_rpm. The command help is shown below:

[oracle@oem12oms ~]$ emcli help get_agentimage_rpm
emcli get_agentimage_rpm
-destination_dir="destination directory"
-platform="linux"

That looks simple enough! It nearly enough was. My first attempt is shown here.

[oracle@oem12oms tmp]$ emcli get_agentimage_rpm -destination=/tmp -platform="Linux x86-64" -version="12.1.0.1.0"
Platform:Linux x86-64
Destination:/tmp
Checking for disk space requirements...
=== Partition Detail ===
Space free : 3 GB
Space required : 1 GB
RPM creation in progress ...
Check the logs at /tmp/get_agentimage_rpm_2011-11-22_12-10-43-PM.log
Copying agent image from software library to /tmp
Setting property ORACLE_HOME to:/u01/gc12.1/oms
calling pulloneoffs with arguments:/u01/gc12.1/oms/u01/gc12.1/oms/sysman/agent/12.1.0.1.0_AgentCore_226.zip12.1.0.1.0Linux x86-64/tmptrue
Agent Image copied successfully...
Creation of RPM started...
RPM creation failed ...

Oops, that didn’t work. I had a look at the log file:

[oracle@oem12oms tmp]$ cat /tmp/get_agentimage_rpm_2011-11-22_12-10-43-PM.log
Platform:Linux x86-64
Version:12.1.0.1.0
Destination:/tmp
Getting Agent Image ...
Getting Platforms list  ...
Platform Short Name:linux_x64
Platform ID:226
Path:/u01/gc12.1/oms/sysman/agent/12.1.0.1.0_AgentCore_226.zip
Final zip location given by the getFullAgentImage api is:/tmp/12.1.0.1.0_PluginsOneoffs_226.zip
Image exists.
Directory /usr/lib/oracle doesnt exist. Please create the directory with write permissions and then retry the emcli command.

Well ok, a requirement for a directory “/usr/lib/oracle” on the OMS wasn’t documented but not a show stopper! After the directory has been created I tried again, and you guessed it: the RPM creation failed again. This time the log’s content read:

[oracle@oem12oms tmp]$ cat /tmp/get_agentimage_rpm_2011-11-22_12-05-15-PM.log
Platform:Linux x86-64
Version:12.1.0.1.0
Destination:/tmp
Getting Agent Image ...
Getting Platforms list  ...
Platform Short Name:linux_x64
Platform ID:226
Path:/u01/gc12.1/oms/sysman/agent/12.1.0.1.0_AgentCore_226.zip
Final zip location given by the getFullAgentImage api is:/tmp/12.1.0.1.0_PluginsOneoffs_226.zip
Image exists.
Executing command:/u01/gc12.1/oms/install/rpm/rpm.sh /tmp /u01/gc12.1/oms 12.1.0.1.0_PluginsOneoffs_226.zip
/u01/gc12.1/oms/install/rpm/rpm.sh: line 53: rpmbuild: command not found
RPM creation failed...
Command : /u01/gc12.1/oms/install/rpm/rpm.sh /tmp /u01/gc12.1/oms 12.1.0.1.0_PluginsOneoffs_226.zip completed with status = 1
Deleting file:/tmp/12.1.0.1.0_PluginsOneoffs_226.zip
RPM creation failed ...

Allright then-rpmbuild wasn’t there-was it documented? Not that I recall off. Again, simple to fix. For RHEL 5 the rpmbuild script is in package “rpm-build.x86_64 : Scripts and executable programs used to build packages”. After applying this the RPM creation succeeded:

[oracle@oem12oms tmp]$ emcli get_agentimage_rpm -destination=/tmp -platform="Linux x86-64" -version="12.1.0.1.0"
Platform:Linux x86-64
Destination:/tmp
Checking for disk space requirements...
=== Partition Detail ===
Space free : 3 GB
Space required : 1 GB
RPM creation in progress ...
Check the logs at /tmp/get_agentimage_rpm_2011-11-22_12-10-43-PM.log
Copying agent image from software library to /tmp
Setting property ORACLE_HOME to:/u01/gc12.1/oms
calling pulloneoffs with arguments:/u01/gc12.1/oms/u01/gc12.1/oms/sysman/agent/12.1.0.1.0_AgentCore_226.zip12.1.0.1.0Linux x86-

64/tmptrue
Agent Image copied successfully...
Creation of RPM started...
RPM creation successful.
Agent image to rpm conversion completed successfully
[oracle@oem12oms tmp]$

Great-result!

On the future managed target

I shipped the RPM to the intended memory target, oem12db.localdomin. In installed the RPM on the database host as shown here:

[oracle@oem12db tmp]$ ls -lrt
total 225316
-rw-r-----. 1 oracle oinstall 230719020 Nov 22 12:18 oracle-agt-12.1.0.1.0-1.0.x86_64.rpm
[oracle@oem12db tmp]$ su -
Password:
[root@oem12db ~]# rpm -ihv /tmp/oracle-agt-12.1.0.1.0-1.0.x86_64.rpm
Preparing...                ########################################### [100%]
Running the prereq
1:oracle-agt             ########################################### [100%]
Follow the below steps to complete the agent rpm installation:
1. Edit the properties file: /usr/lib/oracle/agent/agent.properties with the correct values
2. Execute the command /etc/init.d/config.pl
[root@oem12db ~]#

It’s a “real” RPM, albeit with a (IMO) uncommon file structure for oracle software (extracted with rpm -qil oracle-agt):

Name        : oracle-agt                   Relocations: (not relocatable)
Version     : 12.1.0.1.0                        Vendor: (none)
Release     : 1.0                           Build Date: Tue 22 Nov 2011 12:13:08 PM GMT
Install Date: Tue 22 Nov 2011 12:19:19 PM GMT      Build Host: oem12oms.localdomain
Group       : Applications/OracleAGT        Source RPM: oracle-agt-12.1.0.1.0-1.0.src.rpm
Size        : 559861217                        License: Oracle Corporation
Signature   : (none)
Packager    : Oracle <www.oracle.com>
URL         : http://www.oracle.com
Summary     : Oracle Agent 11g Enterprise Edition
Description :
Oracle Agent 11g Enterprise Edition
/etc/init.d/agentrpm
/etc/init.d/config.pl
/usr/lib/oracle/agent
...

It turned out all the files reside under /usr/lib/oracle (remember that directory I created earlier?). The RPM files won’t stay there though, /usr/lib/oracle is only a staging area as I’ll demonstrate later. The next step is to modify the agent.properties file. Update as needed, my example is shown here:

[root@oem12db ~]# cat /usr/lib/oracle/agent/agent.properties
#-------------------------------------------------------------------------------
#s_OMSHost:<String> OMS host info required to connect to OMS
#s_OMSPort:<String> OMS port info required to connect to OMS
#AGENT_REGISTRATION_PASSWORD:<String> Agent Registration Password needed to
#     establish a secure connection to the OMS.
#-------------------------------------------------------------------------------
s_OMSHost=oem12oms
s_OMSPort=4901
AGENT_REGISTRATION_PASSWORD=topsecret
#-------------------------------------------------------------------------------
#agentUserName:<String> User name with which the agent should be installed.
#agentUserGroup:<String> Group to which the agent user belogs.
#-------------------------------------------------------------------------------
agentUserName=oracle
agentUserGroup=oinstall
#-------------------------------------------------------------------------------
#OraInvLoc:<String> Absolute path of the inventory location where the agent user has write permissions.
#Example : OraInvLoc=/usr/lib/oraInventory
#-------------------------------------------------------------------------------
#OraInvLoc=#OraInvLoc#
#-------------------------------------------------------------------------------
#BASEDIR:<String> Location of the agent base directory.
#Example: BASEDIR=/tmp/agentNG
#-------------------------------------------------------------------------------
BASEDIR=/u01/app/oracle/product/agent12c
#-------------------------------------------------------------------------------
#ORACLE_HOSTNAME:<String> Virtual hostname where the agent is deployed.
#Example: ORACLE_HOSTNAME=hostname.domain
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=oms12db.localdomain

Remember that unlike the 11g agent 12c won’t create an “agent11c” (or “agent12c”) directory-hence I specified /u01/app/oracle/product/agent12c. Also, make sure you have the settings correct! I haven’t found a way to restart the agent setup, and ended removing the software via OUI (this doesn’t imply there is no way to restart the agent configuration!!!)

If you are unsure about the OMS port, grep -i oms_port in the OMS /path/to/oraInventory/logs/ directory. Mine wasn’t 4889 as it would have most likely been in 11.1, but rather 4901. Interestingly you don’t need to worry if the OMS is secured or not, the agent will discovery that.

In my experience you HAVE to make sure that your hostname is recorded in /etc/hosts, even if you are using DNS. I missed that bit in the initial attempt and ended up with an agent bound to localhost.localdomain in the emd.properties file. This can be fixed, but it’s a rather complex manual process.

Once you are happy with the settings, run /etc/init.d/config.pl. In summary, it starts a “clone” operation of the agent home to the base location you specified in agent.properties and starts the agent configuration. Log file locations for each step are indicated in the output, and in my case were in /u01/app/oracle/product/agent12c/core/12.1.0.1.0/cfgtoollogs/ and the oracle inventory/logs directory

When prompted, don’t forget to run root.sh! After the installation completed, the agent was happily communicating with my management server:

[oracle@oem12db ~]$ emctl status agent
Oracle Enterprise Manager 12c Cloud Control 12.1.0.1.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 12.1.0.1.0
OMS Version       : 12.1.0.1.0
Protocol Version  : 12.1.0.1.0
Agent Home        : /u01/app/oracle/product/agent12c/agent_inst
Agent Binaries    : /u01/app/oracle/product/agent12c/core/12.1.0.1.0
Agent Process ID  : 4844
Parent Process ID : 4788
Agent URL         : https://oem12db.localdomain:3872/emd/main/
Repository URL    : https://oem12oms.localdomain:4901/empbs/upload
Started at        : 2011-11-22 16:37:31
Started by user   : oracle
Last Reload       : (none)
Last successful upload                       : 2011-11-22 16:43:56
Last attempted upload                        : 2011-11-22 16:43:56
Total Megabytes of XML files uploaded so far : 0.02
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 51.31%
Collection Status                            : Collections enabled
Last attempted heartbeat to OMS              : 2011-11-22 16:43:37
Last successful heartbeat to OMS             : 2011-11-22 16:43:37

---------------------------------------------------------------
Agent is Running and Ready

You may have heard that the agent functionality is now on a “as needed” basis, i.e. the agent footprint is lower. Instead of including every possible functionality in the agent (such as in 11.1), only functionality that is really needed is added in 12c in form of plugins. This is reflected in the inventory.xml file:

...
<HOME_LIST>
<HOME NAME="agent12g0" LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0" TYPE="O" IDX="2">
<REFHOMELIST>
<REFHOME LOC="/u01/app/oracle/product/agent12c/sbin"/>
<REFHOME LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.1.0"/>
<REFHOME LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.1.0"/>
<REFHOME LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.db.discovery.plugin_12.1.0.1.0"/>
<REFHOME LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.1.0"/>
<REFHOME LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.oh.agent.plugin_12.1.0.1.0"/>
</REFHOMELIST>
</HOME>
<HOME NAME="sbin12g0" LOC="/u01/app/oracle/product/agent12c/sbin" TYPE="O" IDX="3">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
<HOME NAME="oracle_sysman_emas_12_1_0_1_0_discovery_Home0" LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.1.0" TYPE="O" IDX="4" PLUGIN="T">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
<HOME NAME="oracle_sysman_xa_12_1_0_1_0_discovery_Home0" LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.1.0" TYPE="O" IDX="5" PLUGIN="T">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
<HOME NAME="oracle_sysman_db_12_1_0_1_0_discovery_Home0" LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.db.discovery.plugin_12.1.0.1.0" TYPE="O" IDX="6" PLUGIN="T">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
<HOME NAME="oracle_sysman_oh_12_1_0_1_0_discovery_Home0" LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.1.0" TYPE="O" IDX="7" PLUGIN="T">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
<HOME NAME="oracle_sysman_oh_12_1_0_1_0_agent_Home0" LOC="/u01/app/oracle/product/agent12c/plugins/oracle.sysman.oh.agent.plugin_12.1.0.1.0" TYPE="O" IDX="8" PLUGIN="T">
<DEPHOMELIST>
<DEPHOME LOC="/u01/app/oracle/product/agent12c/core/12.1.0.1.0"/>
</DEPHOMELIST>
</HOME>
</HOME_LIST>

I need to read a lot more of the documentation to find out how to add plugins to agents, and that’s for another blog post…Happy monitoring!

The downside

The use of the RPM technology here is a little peculiar-if you run “rpm -q –verify oracle-agt”, you get LOTS of missing files. It’s not really the way RPM is intended to be used, and hence I don’t see an immediate advantage of using the RPM over the agent push method.

About these ads

2 Responses to “Installing OEM 12c agents in RPM format”

  1. The “/usr/lib/oracle directory exists” is mentioned in Prerequisites document. It is just not mentioned to be a OMS side prerequisite. I filed an reader comment on the page. We will see if changes appear…

    • Martin Bach said

      Hi Timo,

      just looked it up-and it’s there as you say. A cursory glance revealed no clue to this directory as a requirement on the management server-thanks for your comment!

      Martin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 2,075 other followers

%d bloggers like this: