Chapter 1 Installing Oracle Enterprise Manager for MySQL Database

Table of Contents

1.1 Prerequisites
1.2 Obtaining and Installing the Plugin
1.3 Adding MySQL Targets
1.3.1 Adding Targets Manually
1.3.2 Adding Targets Using Autodiscovery
1.4 Modifying Target Credentials and Properties
1.5 Deleting a Target
1.6 Logging

Oracle Enterprise Manager for MySQL Database extends Oracle Enterprise Manager to enable monitoring of MySQL servers.

Note

Although Oracle Enterprise Manager for MySQL Database is based on MySQL Enterprise Monitor, it does not contain the following MySQL Enterprise Monitor functionality:

  • Query Analyzer

  • Support for monitoring MySQL Cluster

  • All Advisors and graphs. Oracle Enterprise Manager for MySQL Database contains a subset of the MySQL Enterprise Monitor Advisors and graphs.

  • Replication topology diagrams.

Important

Oracle Enterprise Manager for MySQL Database is commercially licensed and is available in MySQL Enterprise Edition and select Commercial Editions. Learn more at http://www.mysql.com/products/.

This chapter describes how to install Oracle Enterprise Manager for MySQL Database.

To install and deploy the plug-in, you must do the following:

  1. Ensure the prerequisites are installed and correctly configured. For more information, see Section 1.1, “Prerequisites”.

  2. Download the plug-in and deploy it on the OMS and Management Agent as described in the Oracle Enterprise Manager Cloud Control Administrator's Guide.

    Oracle Enterprise Manager for MySQL Database is available from the following locations:

    • The Self Update section of Oracle Enterprise Manager 12.1.0.4 (or higher).

    • Oracle Software Delivery Cloud - available in the MySQL Database Product Pack.

    • My Oracle Support - download from the Patches/Updates tab. (Product: Enterprise Manager for MySQL Database)

  3. Configure a MySQL target in OMS. Adding a target triggers the collection of metrics from the Management Agent. A subset of the collected data is displayed in the target homepage. For more information, see Section 1.3, “Adding MySQL Targets”.

1.1 Prerequisites

This section describes the prerequisites for a successful Oracle Enterprise Manager for MySQL Database installation.

  • Oracle Enterprise Manager Cloud Control 12.1.0.4 (or newer) for OMS (12.1.0.4.0 and Patch 20392036), Enterprise Manager Repository, and Management Agent (12.1.0.4.0 + Patch 20613931). Ensure the agent can successfully communicate with your Oracle Management Service and can upload data.

  • MySQL 5.5 or higher.

  • Supported platforms: The plug-in can be deployed on OEM Management Agents on the following Operating Systems:

    • Solaris (SPARC)

    • Solaris Operating System (x86-64)

    • Linux x86 (32-bit), glib2.4 or higher

    • Linux x86-64 (64-bit), glib2.4 or higher

    • Microsoft Windows x86-64 (64-bit)

    Important

    Consult the MySQL Supported Platforms list for more information. HP-UX, AIX, FreeBSD and Mac OS X are not supported.

  • The user installing the Management Agent must, at least, belong to the MySQL user group of the monitored database.

  • The Management Agent requires a user on the monitored MySQL instance. This user requires the following privileges:

    • SELECT

    • REPLICATION CLIENT

    • SHOW DATABASES

    • PROCESS

    The following example shows how to create these rights for a user named monitoring, assuming a local agent with a socket connection:

              GRANT SELECT, REPLICATION CLIENT, SHOW DATABASES, PROCESS ON *.*
               TO  'monitoring'@‘localhost' IDENTIFIED BY 'password’;"          
            
  • For optimal performance, ensure that the monitored MySQL database is on a different machine from the OMS and Enterprise Manager Repository.

  • Ensure the MyOracle Support credentials are set up using the SYSMAN user.

  • Ensure that the Software Library (also known as the local store) is configured. Updates are downloaded to the local store before they are deployed.

1.2 Obtaining and Installing the Plugin

For instructions on how to obtain, install, upgrade, and deploy the plug-in, consult the following Oracle Enterprise Manager documentation, http://docs.oracle.com/cd/E24628_01/doc.121/e24473/plugin_mngr.htm.

1.3 Adding MySQL Targets

This section describes how to add targets manually and using autodiscovery.

1.3.1 Adding Targets Manually

You must configure a MySQL target that is monitored by Enterprise Manager Cloud Control. Metrics are not collected until the MySQL database is added as a target.

Note

When adding a target, if the plug-in is not deployed on that target, the system automatically deploys the plug-in to the Management Agent on the target host.

  1. From the Setup menu, select Add Target, and select Add Targets Manually.

  2. In the Add Targets Manually page, select Add Targets Declaratively by Specifying Target Monitoring Properties .

  3. In the Target Type field, select MySQL Database.

    The Monitoring Agent field is displayed enabling you to search for a monitoring agent.

    Click the search icon next to the Monitoring Agent field.

  4. The Search and Select Targets page is displayed.

    In the Target Type field, select Agent and click Search.

  5. A list of available agents is returned.

  6. Select the agent and click Select.

    The Search and Select Targets page closes and Monitoring Agent field on the Add Targets Manually page is populated with the name of the selected Monitoring Agent.

  7. On the Add Targets Manually page, click Add Manually.

    The Add MySQL Database page is displayed.

  8. Complete the following fields:

    • Target Name: A unique name for the target. This value is displayed in the All Targets page.

    • MySQL User: The username used to connect to the database. See Section 1.1, “Prerequisites” for more information on configuring this user.

    • MySQL Password: The password of the MySQL user.

    • Confirm MySQL Password: Re-enter the MySQL user password.

    • Host: The hostname of the MySQL database. This can be an IP address or fully-qualified name. If the database is local, you can specify localhost. Specify a value only if TCP/IP is the connection method used. Default host is localhost.

    • Port: The port used to connect to the database. Specify a value only if TCP/IP is the connection method used. Default port is 3306.

    • Socket: The socket used to connect to the database. Specify a value only if socket is the connection method used.

  9. Click OK to save the target.

  10. Click Targets and select All Targetsto return to the All Targets page.

    The new target is displayed as MySQL Database in the Databases Target Type.

Important

Do not attempt to access the new target until a green arrow is displayed for the new target in the Target Status column.

It is also possible to monitor a remote MySQL database without deploying an agent or plug-in to that host. To remotely monitor a MySQL database, repeat these steps with an existing agent and, on the Add MySQL Database page, add the details for the remote database.

Remote monitoring does not allow monitoring of the host machine, only of the MySQL database running on that host.

1.3.2 Adding Targets Using Autodiscovery

It is possible to discover MySQL instances automatically, using OMS Auto Discovery.

To configure Auto Discovery for Oracle MySQL, do the following:

  1. From the Setup menu, select Add Target, Configure Auto Discovery.

    The Setup Discovery Page is displayed.

  2. From the Targets on Hosts table, select the host to auto-discover.

  3. Click Discovery Modules.

    The Discovery Modules: hostname page is displayed.

  4. Select the Oracle MySQL Discovery module.

  5. Click OK to save your changes and continue.

    The Setup Discovery page is displayed again.

    Note

    It can take some time for the instances to be discovered.

  6. From the Setup menu, select Auto Discover Results from the Add Target menu.

    The target(s) added in the previous step are listed in the Targets on Hosts tab.

  7. Select the host and click Promote.

    The Promote Unmanaged Target page is displayed.

  8. Populate the fields as required.

    Note

    The Properties section is auto-populated if the permissions and users are set up correctly. If the permissions are incorrect, or the process is running under another user's account, some of these values do not auto-populate.

    If both Port and Socket are populated, Port takes precedence over Socket. If you want to use socket only, you must delete the value in the Port and Host fields.

  9. Click Promote.

    The Confirmation dialog displays the progress of the promotion and prompts when finished.

  10. Click OK and open the All Targets page to locate the new target.

Auto Discovery Target Naming

The target is named according to the following rules:

  • Hostname:PortNumber - If the target is listening on TCP

  • Hostname:SocketPath - If the target is listening over a socket.

  • Hostname.pid - If neither port number nor socket can be resolved, the process identifier (pid) of the monitored MySQL instance is used.

    Important

    If the Hostname.pid naming convention is used, and the MySQL instance is restarted, a new unmanaged target is added to the results list because a new process id is assigned causing the name of the target to change.

    Hostnames generated using this method are not deleted from the results list if the MySQL server is restarted and the new, generated name added to the list. You must manage the old, generated hostnames manually.

1.4 Modifying Target Credentials and Properties

It is possible to change the credentials and connection properties after setting up the target. These properties can be changed from the command line and from the OMS dashboard.

Modifying the Target Instance Definition from the Command Line

You can modify the target instance definition from the command line using the modify_target verb with the -type="oracle_omys_database" parameter.

For more information on the modify_target verb, see Target Data Verbs in the Oracle Enterprise Manager Cloud Control Administrator's Guide.

The following target properties can be modified:

  • Username: set using the -credentials parameter with the oracle_omys_database_username property.

  • Password: set using the -credentials parameter with the oracle_omys_database_password property.

  • Host name: set using the -properties parameter with the oracle_omys_database_host property.

  • Port: set using the -properties parameter with the oracle_omys_database_port property.

  • Socket: set using the -properties parameter with the oracle_omys_database_socket property.

The following example changes the properties and credentials of an existing target instance definition:

        
       $ emcli modify_target -name="targetExample:3306" -type="oracle_omys_database" 
         -credentials="oracle_omys_database_username=root;oracle_omys_database_password:password1"
         -properties="oracle_omys_database_host=example2;oracle_omys_database_port=9999" 
         -on_agent
        
      

where:

  • -name defines the name of the target to modify.

  • -type defines the type of the monitored instance. oracle_omys_database defines a MySQL database type.

  • -credentials changes the username and password to root and password1, respectively.

  • -properties changes the host and port number to example2 and 9999, respectively.

  • -on_agent propagates the changes to the Management Agent collecting this target's metrics.

Modifying the Target Instance Definition from the OMS Dashboard

To change the credentials used to log on to the monitored MySQL database, do the following:

  1. Click Setup to expand the menu.

  2. From the Security menu, select Monitoring Credentials.

    The Monitoring Credentials page is displayed.

  3. Select MySQL Database from the list of target types and click the Manage Monitoring Credentials button.

    The MySQL Database Monitoring Credentials page is displayed.

  4. Select the target you want to edit, and click Set Credentials.

  5. Edit the credentials as required and click Save.

    The new credentials are saved.

To edit the connection details, do the following:

  1. Navigate to the target page of the target you want to edit.

  2. From the target's configuration menu, select Target Setup and click Monitoring Configuration.

    The Monitoring Configuration page is displayed.

  3. Edit the Host, Port, or Socket as required and click OK to save your changes.

1.5 Deleting a Target

To delete a target, do the following:

  1. Navigate to the remotely-monitored target's homepage.

  2. From the MySQL Database menu, select Remove Target from the Target Setup menu.

  3. Follow the instructions on screen to remove the selected target.

    Note

    Removing a target does not undeploy the plug-in from the management agent, but stops the collection of metrics from that host.

1.6 Logging

This section describes the Oracle Enterprise Manager for MySQL Database logging. For information on the Oracle Management Service or Management Agent logs, see Locating and Configuring Enterprise Manager Log Files.

Management Agent uses the log4j library for all agent and plug-in logging. The logging configuration is defined by the properties of the log4j.properties file.

Log files specific to the Oracle Enterprise Manager for MySQL Database are written to the following location of your OEM Agent installation:

/plugins/oracle.mysql.omys.agent.plugin_versionNumber/scripts/oracle_omys_database/logs

The log configuration is stored in the following directory of your OEM Agent installation:

/plugins/oracle.mysql.omys.agent.plugin_versionNumber/scripts/oracle_omys_database/etc

where versionNumber is the version of the plug-in.

The auto-discovery plug-in's logging is also configured by a log4j.properties configuration. By default this file is created in the /plugins/oracle.mysql.omys.discovery.plugin_versionNumber/scripts/oracle_omys_database/etc directory of your Management Agent installation.

The default auto-discovery log output directory is: /plugins/oracle.mysql.omys.discovery.plugin_versionNumber/scripts/oracle_omys_database/logs

versionNumber is the version of the plug-in.

The following is an example of the log4j.properties file:

log4j.rootCategory = INFO, file

#log4j.logger.com.mysql.etools.emplugin.collection.availability = DEBUG
#log4j.logger.com.mysql.etools.emplugin.collection.discovery = DEBUG
#log4j.logger.com.mysql.etools.emplugin.collection.assets = DEBUG

log4j.logger.com.mysql.etools.agent.collection.os.StandardHostIdProvider = WARN
log4j.logger.org.springframework.beans.factory.support.DefaultListableBeanFactory = WARN
log4j.logger.org.springframework.context.support.ClassPathXmlApplicationContext = WARN
log4j.logger.org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler = WARN
log4j.logger.com.mysql.etools.schedule.Scheduler = WARN
log4j.logger.org.springframework.beans.factory.xml.XmlBeanDefinitionReader = WARN
log4j.logger.org.springframework.jdbc.support.SQLErrorCodesFactory = WARN
log4j.logger.com.mysql.etools.agent.collection.SigarExecutor = WARN
log4j.logger.org.springframework.jdbc.datasource.SingleConnectionDataSource = WARN
log4j.logger.com.mysql.etools.springboard.Springboard = WARN

log4j.appender.file = org.apache.log4j.RollingFileAppender
log4j.appender.file.layout = org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern = %d %5p [%t:%c] %m%n
log4j.appender.file.Append = true
log4j.appender.file.MaxFileSize = 10MB
log4j.appender.file.MaxBackupIndex = 10
log4j.appender.file.File = ${logging.path}/myoem.log        
      

A general log and collection-type logs are generated for each monitored MySQL instance. The collection-type logs, defined by the log4j.logger.com.mysql.etools.emplugin.collection.* properties, which are commented out by default, log details of availability, metrics, response times, and so on. One log file is generated for each collection type. The general log, defined by the log4j.logger.* properties, logs details of the plug-in behavior, errors, status messages and so on. The log files rollover at 10MB and up to 10 files per log type are retained. Logs older than the 10-file limit are deleted.

It is not recommended to edit the log properties unless requested to do so by your Support representative.

The log4j.appender.* properties define the logging properties and output.