Configure High CPU alert for MySQL Database System (MDS) in OCI

August 1, 2021 | 4 minute read
Jitender Singh
Senior Cloud Engineer
Text Size 100%:

Let’s say our production MDS is running in Oracle cloud, and we have to automate alert configuration (say on high CPU utilization) so that we can identify the cause. If we don’t have alert in place, then it would be difficult to troubleshoot live and see what is going on in MySQL database system by running some commands.

 

Pre-requisites:


 

  1. You need to have an active MDS running on any region.
  2. Topic and subscription. Topic is used to send message to its subscription. You can follow below link to create topic and subscription.

https://docs.oracle.com/en-us/iaas/Content/Notification/Tasks/managingtopicsandsubscriptions.htm

 

For this Lab, I have already created Topic “Notify-Event” and it is subscribed to my email id. 

 

Graphical user interface, text, application

Description automatically generated

 

Graphical user interface, application, email

Description automatically generated

 

Now let’s navigate to MySQL Database in OCI console and configure alert for high CPU utilization.

 

Step 1: Navigate to MDS console and click on database. 

Step 2: Click on Metrics shown under resources TAB on console.

Step 3: Scroll down to CPU metrics and from drop down select “Create an alarm on this Query”

 

Graphical user interface

Description automatically generated

On next section, provide name of your Alarm and select Alarm severity from the option available.

 

Graphical user interface, application

Description automatically generated

 

Scroll down to section metric description and provide/select information.

 

Graphical user interface, application

Description automatically generated

 

Compartment: select compartment in which your MDS is running.

Metric namespace: oci_mysql_database

Metric name: CPUUtilization

Interval: 1m

Statistic: max

 

In section Metric Dimensions, select resourceID and from drop down menu select your MDS resource. You can also select resourceName for that matter.

Now scroll down to Trigger rule section, here you must define threshold value. I have selected 60 for this demo. Which means when CPU utilization will reach 60% then it will trigger this alarm.

 

Graphical user interface, application

Description automatically generated

 

On next section, select the topic that you already created. For this demo (as a pre-requisite) I am using topic “Notify-Event” and click on “Enable this alarm”. Click Save Alarm

 

Graphical user interface, application, Teams

Description automatically generated

 

Once you click on “Save Alarm”, this Alarm will be active.