Wednesday, December 5, 2012

OMS 11g: Copy agent binaries to another server and reconfigure

System admins cloned a server, including OMS agent's binaries, and I did not want to reinstall it.
At start, agent should be down.
Edit $OMS_HOME/sysman/config/emd.properties and change EMD_URL entry to your new server's hostname:
EMD_URL=http://newserver:3872/emd/main/

Delete a few files:
cd $OMS_HOME/sysman/emd
rm -rf state
rm -rf upload
rm lastupld.xml
rm agntstmp.txt
rm protocol.ini
rm blackouts.xml
rm targets.xml

Create a new targets.xml:
<?xml version = "1.0"?>
<Targets>
</Targets>

Start agent:
emctl start agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Starting agent ...... started.

Upload:
emctl upload
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully

Get its status and check "Agent URL" is pointing to new server and if upload was successful:
emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /oragrid/agent11g
Agent binaries    : /oragrid/agent11g
Agent Process ID  : 8061080
Parent Process ID : 5701676
Agent URL         : http://newserver:3872/emd/main/
Repository URL    : http://OMSserver:4889/em/upload/
Started at        : 2012-12-05 13:01:57
Started by user   : oragrid
Last Reload       : 2012-12-05 13:03:06
Last successful upload                       : 2012-12-05 13:03:09
Total Megabytes of XML files uploaded so far :     3.09
Number of XML files pending upload           :        0
Size of XML files pending upload(MB)         :     0.00
Available disk space on upload filesystem    :    44.41%
Last successful heartbeat to OMS             : 2012-12-05 13:03:00
---------------------------------------------------------------
Agent is Running and Ready

Now, if you login to your OMS, you will see your new agent running, but it will not monitor the host installed in. OMS will not even know in which host this agent runs.

Stop agent:
emctl stop agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Stopping agent ... stopped.

Edit $OMS_HOME/sysman/emd/targets.xml and add the host target:
<Targets AGENT_TOKEN="23e6c87aa252cb56f70800785be11d6071944de7">
        <Target TYPE="oracle_emd" NAME="newserver:3872"/>
        <Target TYPE="host" NAME="newserver"/>
</Targets>

Start, upload and status once more:
emctl start agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
Starting agent ..... started.

emctl upload
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully

emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0 
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /oragrid/agent11g
Agent binaries    : /oragrid/agent11g
Agent Process ID  : 5308612
Parent Process ID : 9633920
Agent URL         : http://newserver:3872/emd/main/
Repository URL    : http://OMSserver:4889/em/upload/
Started at        : 2012-12-05 14:04:03
Started by user   : oragrid
Last Reload       : 2012-12-05 14:04:03
Last successful upload                       : 2012-12-05 14:04:15
Total Megabytes of XML files uploaded so far :     0.51
Number of XML files pending upload           :        1
Size of XML files pending upload(MB)         :     1.15
Available disk space on upload filesystem    :    44.40%
Last successful heartbeat to OMS             : 2012-12-05 14:04:05
---------------------------------------------------------------
Agent is Running and Ready

Now, login to your OMS add under Targets tab, All Targets subtab search for type Agent and your new server's hostname.
You will find your new agent with only one monitoring target, your host.

No comments:

Post a Comment