How to remove Agent/targets from Grid Control neatly

6 08 2008

I was given the task to remove the target host/agents and other listed targets of Server1 from Oracle grid control. At first I thought it was very easy and I was definitely correct. Here’s what happened:

From OEM Grid Control I clicked on targets and selected the Server1 from the list. Then from its homepage I clicked on the the targets and then I eventually select all the targets except of course from the agent. Note: (the management agent of server1 must be running to do this). The targets were successfully deleted and now the only thing left is the host and the agent of Server1.

To remove the agent and host form the list, I stop the management agent of server1 then I went back to my OEM Grid control to remove the host Server1. Now there comes the challenge, No matter how many times I tried to delete the host Server1 from oem grid control It seems like the page is just running and nothing happens. No matter how long I’ve waited the host Server1 still remains on the list.

Now to clean it manually, I connect to the OEM Grid Repository and perform the following:

SQL> select target_name from mgmt_targets where target_type=’oracle_emd’;

This command show me the list of all the registered targets from my OEM and I can see that Server1 is still there. Then to manually remove Server1 from the list, I then execute:

SQL> exec mgmt_admin.cleanup_agent(‘Server1:3872′);

It will take a while at least 3 to 5 mins the most. Once it was completed  I quickly checked my OEM Grid Control Target List and voila!!! Server1 was successfully removed from the target list together with its agent.

Thanks to Metalink Note:454081.1 and to Luis Cardenas post (http://www.lazydba.com/oracle/0__146127.html)  who gave me the idea to solve my problem.




How to remove a deleted agent from the GRID Control repository database?

5 08 2008
Howto: How to remove a deleted agent from the GRID Control repository database?
Doc ID: Note:454081.1 Type: HOWTO
Last Revision Date: 24-OCT-2007 Status: PUBLISHED
In this Document
Goal
Solution
References


Applies to:

Enterprise Manager Grid Control – Version: 10.2.0.1 to 10.2.0.4
Information in this document applies to any platform.

Goal

The targets are removed from Grid Control UI.  However, it seems it was not completely removed.  The repository still has reference to the removed Agent. Agent was not totally removed from the repository.

How do you remove the deleted agent from the repository?

Solution

1. Please ensure that the agent is stopped.

2. Logon with sqlplus against the repository database as user sysman
and run following command:

exec mgmt_admin.cleanup_agent('<myserver>:<port>');

3. If this program are deleting anything end with submit

4. If the procedure find something to delete you can now start the agent again.

5. If this procedure doesn’t find anything for delete

5.1 Edit the agent agent side edit the $ORACLE_HOME/sysman/config/emd.properties
Change the port number in:
EMD_URL=https://server:port/emd/main/
to the next free port at this node

5.2 Save the emd.properties

5.3 Confirm that the Agent home $ORACLE_HOME/sysman/emd/targets.xml file has the new port number defined for the emd agent.

5.4 Start the agent.

The agent will be now added with the new port number.

It is strongly suggest always to use the procedure
exec mgmt_admin.cleanup_agent(‘<myserver>:<port>’);
to remove entire host targets from the Grid Control.
This avoid that anything not deleted correctly




How to Point an Agent to a different Grid Control OMS and Repository?

1 08 2008
Subject: How to Point an Agent to a different Grid Control OMS and Repository?
Doc ID: Note:413228.1 Type: HOWTO
Last Revision Date: 25-FEB-2008 Status: PUBLISHED
In this Document
Goal
Solution


Applies to:

Enterprise Manager Grid Control – Version: 10.2.0.0
Information in this document applies to any platform.

Goal

This Note intends to explain how to point an Oracle Management Agent to a different Grid Control OMS and Repository?

NOTE: These steps are NOT necessary if you are simply pointing the Oracle Management Agent to a new OMS that points to the SAME repository.  If simply moving from one OMS to another within the same Grid infrastructure, follow the instructions in the Documentation, Oracle® Enterprise Manager Advanced Configuration, Chapter 12 Reconfiguring the Management Agent and Management Service, 12.1.1 Configuring the Management Agent to Use a New Management Service

Solution

A. Drop the Agent from the current OMS

Note: this assumes that the Agent is still pointing to the old OMS. You will first drop the Agent from the old OMS, then add it to the new OMS. This can be ignored if the OMS doesn’t exist anymore.

1. Leave the monitoring agent up and running in order to delete all the targets, except the host and the agent itself).

2. From the old OMS, drop all the Targets on the host to be removed, except the Host and Agent.

Do not remove Host yet, but to confirm all targets are gone, choose Targets > Hosts, highlight the host in the list and hit “Remove” button. Grid will not allow the Host to be dropped until all targets on the Host are gone, so this will list any remaining targets. Again: Do not remove Host yet.

All targets except the Host and Agent should now be gone from the OMS.

3. Confirm the targets (except Host and Agent) are removed successfully and completely from the OMS:

Click on “Setup” in upper right.
Click on the “EM 10g Grid Control Management System” tab

You will see this information on the page:

–> Management Services and Repository
–> Overview page
–> General section
–> Deleted Targets: < click on the digit listed here >

3a. Click on “Deleted Targets” (Note this only appears once a delete is attempted.)

3b. Confirm that the “Time Delete Completed” column is filled in; once that column is filled in then the delete is complete.

4. Stop the monitoring Agent

5. Drop the Host target from the old OMS.
Targets > Hosts, highlight the host in the list and hit “Remove” button.

Monitor for the “Time Delete Completed” column.
Proceed once the column is updated.

6. Drop the Agent target from the old OMS.

Targets > All Targets > [pick Agent from list] > “Remove” button.

Monitor for the “Time Delete Completed” column.
Proceed once the column is updated.

–> At this point the removal from the old OMS is completed.

B. Point the Agent at the new OMS

7. Follow the steps to reconfigure the Agent to point to the new OMS.

Here is the Documentation reference, which does explain several steps in a clear manner and will help clarify the process needed.

Oracle® Enterprise Manager Advanced Configuration, Chapter 12 Reconfiguring the Management Agent and Management Service, 12.1.1 Configuring the Management Agent to Use a New Management Service

Quick Summary of steps to point Agent at new OMS

To associate the Management Agent with a new Management Service after you have installed the Management Agent:

#1 Stop the agent

#2 Edit the Agent’s $ORACLE_HOME/sysman/config/emd.properties file

#3 Search for REPOSITORY_URL
Change this to point to the non-secure Grid Control hostname and port
*also change HTTPS://….. to HTTP (non-secure.)

#4 Search for EMD_URL
This is your Agent’s address – if it has HTTPS, change it to HTTP

#5 Modify the value for the emdWalletSrcUrl and emdWalletDest properties. The emdWalletSrcUrl references the new Management Service. The emdWalletDest is the location where the agent saves the wallet received from the OMS, in its own file system. This is normally a directory on the agent node.

For example, if the new Management Service is on a host called mgmthost2.acme.com, modify the properties as follows:
emdWalletSrcUrl=http://mgmthost2.acme.com:4889/em/wallets/emd
emdWalletDest=<AGENT_HOME>/sysman/config/server

#6 Save and exit emd.properties.

Disclaimer: Clean starting the agent is only to be performed in this specific scenario and should only be used for all other issues under guidance from Oracle Support as this can damage the functionality of Grid Control and may require a re-installation.

#7 Clean up Agent: from the Agent $ORACLE_HOME

rm -r $ORACLE_HOME/sysman/emd/state/*
rm -r $ORACLE_HOME/sysman/emd/collection/*
rm -r $ORACLE_HOME/sysman/emd/upload/*
rm $ORACLE_HOME/sysman/emd/lastupld.xml
rm $ORACLE_HOME/sysman/emd/agntstmp.txt
rm $ORACLE_HOME/sysman/emd/blackouts.xml
rm $ORACLE_HOME/sysman/emd/protocol.ini

#8 Issue an agent clearstate from the Agent $ORACLE_HOME
$ORACLE_HOME/bin/emctl clearstate agent

#9 Secure the agent
$ORACLE_HOME/bin/emctl secure agent
*if this fails, double-check OMS information and start from step #2 again

#10 Start the agent
$ORACLE_HOME/bin/emctl start agent
*wait about 30 seconds before going to step 11 – give agent time to “wake up”

#11 Force an upload to the OMS
$ORACLE_HOME/bin/emctl upload agent

After 10-15 minutes the Agent and Host should show up in the new OMS.





Monitor the size of Log Files using OEM

1 08 2008

answer got from HarryP

From Grid Control:

Navigate to Hosts.
Select a host you wish to monitor for disk usage/whatever.
Navigate to Metric and Policy Settings (near bottom of the page)
Ta-da! It’s all there for you to play with! You can add new metrics to monitor for.





Installing management Agent (10.2.0.3)

22 07 2008

Select this option to install the Management Agent in an Oracle home directory on a specified host target. Each host you wish to monitor must have an Agent installed. Software for OEM agent is available from oracle site.

You can install the Management Agent in the following ways:

· On each host computer, run Oracle Universal Installer from the Enterprise Manager DVD-ROM and select the Additional Management Agent installation type. This method installs one Agent at a time in interactive GUI mode. You may also perform silent installations using a response file.

· Use the Agent Deploy application to perform a fresh agent installation (standalone or cluster agent) or a shared agent installation.

· Use the nfsagentinstall script to install and deploy the shared Mangement Agent.

· Use the agentDownload script to install and deploy Management Agents to many managed hosts through HTTP or over the network.

See Also:

See Chapter 5, ” Deploying the Management Agent” for a full and detailed explanation on installing Management Agents using the agentDownload script and the nfsagentinstall script.

See Appendix G, “Assigning Custom Ports” for information on assigning custom port numbers for Enterprise Manager components.

Attention:

If you install the Management Agent on a system where you have already installed an Oracle Application Server instance, you must install the Management Agent from a user account that belongs to the same OS Group group that was used to install the Application Server. Otherwise, you cannot monitor the application server metrics.

· To see which group was used to install the Application Server, type ls -l on the command line in the directory containing opmn.xml: <AS_ORACLE_HOME>/opmn/conf.

· To see the groups to which you belong, type groups on the command line. You may be a member of several groups. Note that it is not sufficient to be a member of the group used to install the Application Server; that group must be your current group.

· To see which user/group you are currently using, type id on the command line. Use the newgrp command to change to the group used to install the Application Server. Oracle recommends installing all software using a single group.

Prerequisites

Ensure the Agent Oracle home must not contain any other Oracle software installation.

Note:

Enterprise Manager does not support uploading of data to the same Management Repository from two Management Agents running on the same host.

To Install an Additional Management Agent Using OUI

1. Start the Oracle Universal Installer by running the runInstaller script in Linux (<DVD>/runInstaller) from the top directory of the DVD.

2. In the Specify Installation Type page, select the fourth option (Additional Management Agent), and specify the parent directory path and installation name.

Figure 3-20 Specify Installation Type

Specify Installation Type

Specify Installation Type

3. In the Specify Installation Location page, specify the full path to the parent directory (base directory), for example, /scratch/OracleHomes. The agent home created during the installation is placed as a sub-directory under this parent directory. For example: agent10g.

Note:

Ensure you do not use symbolic links to the Oracle home path.

The installer by default installs the selected products in the English language.

a. If you want to install the product in a different language, click Product Languages.

b. The Language Selection page appears. Make the required language selections here, and click Next. See Figure 3-3, “Language Selection” for details.

4. The Product Specific Prerequisites Check page appears.

This page displays the name, type, and status for all prerequisite checks designed for the installation. Automatic checks are run first, followed by optional and manual checks.

Depending on the status of the automatic checks, you must verify all warning and manual checks. To do this, select the appropriate prerequisite status check box and click Retry. As each check runs, a progress bar is shown, and test details (expected results, actual results, error messages, instructions) are displayed in the details section at the bottom of the page. See Figure 3-5, “Product-Specific Prerequisite Checks” for more information.

Note:

You can also run these prerequisite checks in standalone mode, prior to starting the runInstaller. For more information on running these prerequisite checks in standalone mode, see Chapter1, “Running the Prerequisite Checker in Standalone Mode”for more information.

5. Click Next. The Specify Oracle Management Service Location page appears.

Figure 3-21 Specify Oracle Management Service Location

a. Specify the Management Service host name. For example: dlsun1444.acme.com. Use the fully-qualified host name (including domain).

ATTENTION:

When specifying the host name, ensure you do not include the protocol (that is, http:// or https://).

b. Enter the port number for the Management Service. The default port is 4889 and the default secure port number is 1159.

However, even if you are specifying a secure Management Service, you must still enter the non-secure port number (4889) here. You must connect over HTTP to receive the certificate before you can connect over HTTPS.

Note:

If your Management Service has been configured to use HTTPS, you are prompted to enter the Agent Registration password (used to secure the management Service environment). If you do not know the password, obtain it from the user who configured the Management Service for SSL.

6. Click Next. If the Management Service is found to be running in a secure mode, the Specify Agent Registration Password page appears. You must provide the correct password to enable communications between the new Management Agent and the SSL-enabled Management Service.

Figure 3-22 Specify Agent Registration Password

IMPORTANT:

If you do not know the password and choose to leave the Password field blank, you must do the following after installation to enable communication between the agent and secure OMS:

· Find out the correct password for the secure OMS environment. If you do not know the password, obtain it from the user who configured the Management Service for SSL.

· In the <AGENT_HOME>/bin directory, execute the following command:

·                emctl secure agent <password>
·                 

where <password> is the Agent Registration Password.

7. Click Next. The Summary page appears.

This page displays a summary of the options that you have selected during the installation process. Depending on the installation type, this page displays any or all of the following details:

· Global Settings

· Product Languages

· Space Requirements

· New Installations

For more information on each of the above-listed details, see the Enterprise Manager Online Help.

Verify the choices that you have made and click Install to start the installation. Enterprise Manager Installer starts installing the selected Oracle product.

8. During the installation, you are prompted to execute certain configuration scripts. These scripts and their locations are listed in the Execute Configuration Scripts dialog that is displayed (only for Linux). Figure 3-12, “Execute Configuration Scripts” provides details on this page .

. To execute these scripts, go to the terminal window, log in as root, and run these configuration scripts.

a. Return to the Execute Configuration Scripts dialog box after executing the scripts, and click OK to continue the installation.

9. The Configuration Assistants page appears. At this point, the installer starts running the recommended configuration tools.

This page displays the name, status, and the type of each configuration tool that Oracle recommends to be run before completing the installation. Refer to Table 3-4 to see the list of configuration tools that are run.

See Appendix D, “Executing the runConfig Command Line Tool” for information on executing the runConfig tool.

10. After successfully running all the recommended configuration tools, click Next. The End of Installation page appears.

This page displays some important information about the products you have installed. This information is also available in the <AGENT_HOME>/sysman/setupinfo.txt file.

For example, it might contain information about the URLs for particular Web applications. If necessary, write this information down so that you can remember it.