Add MySQL Database

You can add MySQL Database entities using the Add Entity UI or using the cloud agent command line interface (omcli) with the appropriate JSON files.

Step 1: Prepare MySQL Database for monitoring.

Prerequisites
To enable monitoring for a My SQL Database, you can create a special database user, for example, moncs as follows:
  1. Create a user:

    CREATE USER 'moncs'@'l hostname' IDENTIFIED BY 'password';
  2. Grant appropriate privileges:

    GRANT SELECT, SHOW DATABASES  ON *.* TO 'moncs'@'hostname ' IDENTIFIED BY 'password';
    GRANT SELECT, SHOW DATABASES  ON *.* TO ' moncs '@'%' IDENTIFIED BY 'password';
  3. Flush privileges.

Step 2: Decide how you want to add the MySQL Database.

You can add MySQL Database entities using one of two ways:

  • Add them from UI
  • Use the agent's omcli add_entity command with the appropriate JSON files

Adding Entities from the UI

  1. From the Management Cloud main menu, select Administration, Discovery, and then Add Entity. The Add Entity page displays.
  2. Select the MySQL Database Entity Type.
  3. Enter the following UI properties.
    MySQL Database UI Properties
    • Entity Name: Name displayed in the Oracle Management Cloud console.
    • JDBC URL: The connection URL for the MySQL Database. The URL follows the format: jdbc:mysql://<host_name>:<port>/mysql where host_name is a fully-qualified host name where MySQL Database is installed and port is the MySQL Database port defined at installation time.
    • Host Name: The fully-qualified host name where MySQL Database is installed.
    • Cloud Agent: Agent monitoring the host on which the database is installed.

    Monitoring Credentials

    • Username: MySQL Database user name to be used for monitoring.
    • Password: MySQL Database user password.

See Add Entities from the Console for detailed instructions on using the Add Entity UI.

Using omcli and the Appropriate JSON Files

  1. Download and extract the required JSON file(s) from the master JSON zip file. See the table below for the specific JSON files you'll need.
  2. Edit the file(s) and specify the requisite properties shown below.
    MySQL Database JSON Properties and Files

    Definition File: omc_mysql_db_sample.json

    • name: Your MySQL database name.

    • display name: Name displayed in the Oracle Infrastructure Monitoring Service User Interface.

    • timezoneRegion:Time zone of your entity. It is recommended that you use the long values IANA-maintained TZ database time zones. For example: America/New_York

    • url: Under “value”, provide the connection URL used to connect to the installed MySQL database. The URL follows the format:

      jdbc:mysql://<host_name>:<port>/mysql where host_name is a fully-qualified host name where MySQL Database is installed and port is the MySQL Database port defined at installation time.

    • hostname: Under “value”, provide the fully-qualified host name where MySQL Database is installed.

    • is_cluster: (TRUE/FALSE) Specifies whether or not you are adding a MySQL Cluster Database.

    Definition File: omc_mysql_db_cluster_sample.json

    • url

      jdbc:mysql://host1:<port1>,host2:<port2>/dbname

      where:

      • Host 1 and Host 2 would be same in case of Single Host Cluster

      • Instance 1 / Node 1

        instance_name: <host1>.mycompany.com:<port1>

      • Instance 2 / Node 2

        instance_name: <host2>.mycompany.com:<port2>

    • jdbcdriver: com.mysql.jdbc.Driver
    • MachineName: Your MySQL Database Host Name
    • Is Cluster: true/false
    • capability: monitoring

    Credential File: omc_mysql_creds.json

    • DBUserName: Under “value”, within the square brackets, provide the MySQL database user name to be used for monitoring. You must have defined this user in the Prerequisite Tasks step.

    • DBPassword: Under “value”, within the square brackets, provide the MySQL database monitoring user's password.

    Do not remove the square brackets.

  3. Add the entity using omcli.
    omcli add_entity agent DEFINITION_FILE [-credential_file CREDENTIAL_FILE [-encryption_method_gpg]] 
  4. Verify the status of the newly added entity.
    omcli status_entity agent DEFINITION_FILE

See step 4. Adding Entities to Your Service of Add Entities Using JSON Files for more information.

Step 3: (Optional but recommended) Set up alerts.

To enable lights-out monitoring, you can set up alert rules to generate alerts and send notifications if your entities have performance issues.

See Set Up Alert Rules and Set Up Alert Thresholds and Notifications.

Troubleshooting

If you run into any issues regarding discovery or monitoring of MySQL Database, see the following: