DBA Hub

📋Steps in this guide1/5

EMCLI : Manage Agents using Enterprise Manager Command Line Interface (Cloud Control)

This article describes how to manage agents in Enterprise Manager Cloud Control using EMCLI, rather than using the web interface.

oracle miscconfigurationintermediate
by OracleDba
13 views
1

Setup

You can perform these actions from anywhere with an EMCLI client , but for this example we're going to use the EMCLI client on the Cloud Control server. We use the following commands to connect to the OMS and sync the EMCLI client.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
unset SSH_ASKPASS
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst
alias emcli='${OMS_HOME}/bin/emcli'

emcli login -username=sysman
emcli sync
2

Add Agent

Make sure the directory is present on the server before attempting to push an agent to it. Use the verb to push the agent to the server to be monitored. Run the "root.sh" file on the monitored server. For example. You need to know "Platform ID" of the destination server. The available IDs can be listed using the verb. After adding the agent, you should set the preferred credentials, as described here .

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
AGENT_HOST="my-host.localdomain"
AGENT_HOST_CREDENTIAL="NC_HOST_MY_HOST"
AGENT_PORT="3872"
AGENT_BASE_DIR="/u01/app/oracle/product/agent13c"
AGENT_PLATFORM="226"

emcli submit_add_host \
  -host_names="${AGENT_HOST}" \
  -platform="${AGENT_PLATFORM}" \
  -installation_base_directory="${AGENT_BASE_DIR}" \
  -credential_name="${AGENT_HOST_CREDENTIAL}" \
  -port="${AGENT_PORT}" \
  -wait_for_completion

/u01/app/oracle/product/agent13c/agent_13.3.0.0.0/root.sh

emcli list_add_host_platforms -all
Platform ID  Platform Name
226          Linux x86-64
197          HP-UX Itanium
...
3

Remove Agent

You can only remove an agent if it is stopped, so you may want to issue a stop command before attempting to remove the agent. The following example uses the and verbs to achieve this. Remember to delete the contents of the on the host.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
AGENT_HOST="my-host.localdomain"
AGENT_HOST_CREDENTIAL="NC_HOST_MY_HOST"
AGENT_PORT="3872"

emcli stop_agent \
  -agent_name="${AGENT_HOST}:${AGENT_PORT}" \
  -credential_name="${AGENT_HOST_CREDENTIAL}"
 
emcli delete_target \
  -name="${AGENT_HOST}:${AGENT_PORT}" \
  -type="oracle_emd" \
  -delete_monitored_targets \
  -async
4

Upgrade Agent

You can create an upgrade job for an existing agent using the verb. The following example assumes the preferred credential are set for the host the agent is running on. You can read how to do that here . Once the job is created it will tell you how to monitor the job in cloud control. Alternatively you can monitor it using the verb, as shown below. If the preferred credential doesn't have access, you will have to run the "root.sh" file on the monitored server. For example.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
AGENT_HOST="my-host.localdomain"
AGENT_PORT="3872"
UPGRADE_JOB_NAME="UPG_MY_HOST_AGENT_1"

emcli upgrade_agents \
  -agents="${AGENT_HOST}:${AGENT_PORT}"\
  -job_name="${UPGRADE_JOB_NAME}"

emcli get_agent_upgrade_status -job_name="${UPGRADE_JOB_NAME}"

/u01/app/oracle/product/agent13c/agent_13.3.0.0.0/root.sh
5

Help

The usage of the commands referenced in this article can displayed using the following commands. You can also check out all the other agent verbs in the Help Command Output . For more information see: - EMCLI : All Articles Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
emcli help list_add_host_platforms
emcli help submit_add_host
emcli help stop_agent
emcli help delete_target
emcli help upgrade_agents

emcli help

Comments (0)

Please to add comments

No comments yet. Be the first to comment!