Enhanced Monitoring provides OS metrics such as Free Memory, Active Memory, Swap Free, Processes Running, and File System Used. These metrics can be used to understand your environment's performance and are ingested by CloudWatch Logs as log entries.

CloudWatch allows you to create alarms based on metrics. These alarms execute actions, and you can publish these metrics from within your infrastructure, device, or application into CloudWatch as a custom metric.

By using Enhanced Monitoring and CloudWatch together, you can automate tasks by creating a custom metric for the CloudWatch Logs RDS ingested date from the Enhanced Monitoring metrics.

Create a custom metric using filters on a log group

Note: These steps require that Enhanced Monitoring is enabled in your RDS instance; for more information, see Monitoring Amazon RDS.

1.    In the CloudWatch console, choose Logs from the left navigation pane, locate RDSOSMetrics in the list of Log Groups, and then choose the Filters link.

2.    Choose Add Metric Filter.

3.    Choose a Filter Pattern term for your RDS instance, for example:

{ $.instanceID = "nameOfYourRDSInstance"}

4.    Choose the Log Data to test and then choose Assign Metric.

5.    Choose a Metric Namespace and Metric Name, and then select the Show advanced metric settings link.

6.    Enter a Metric Value—for example, $.cpuUtilization.idle—and then choose Create Filter.

Automation

There are more than 60 monitoring metrics per RDS instance, so if you want to perform this process for additional metrics, you must repeat these steps for each metric.

You can use a script to automate this process. Here is an example script (RDSCreateMetricsFromEnhancedMonitoring.py) that uses an RDS MySQL DB instance that will work with the following engines:

  • MySQL
  • MariaDB
  • Amazon Aurora
  • PostgreSQL

To you use the script, you must specify the RDS instance that has Enhanced Monitoring enabled, the namespace where you want these metrics to reside, and, optionally, the names of the metrics and the region. If none of these optional fields are specified, the script will consider all the metrics to publish and use the region by default specified in the file .aws/config using AWS Command Line Interface (CLI).

The names of the metrics must be specified by the following pattern:

group.metricname

Here are some examples; for more information, see Monitoring Amazon RDS.

cpuUtilization.idle

diskIO.readKb

The following sample code illustrates a call to enable this metric for cpuUtilization.idle and diskIO.readKb:

python RDSCreateMetricsFromEnhancedMonitoring.py --rds_instance mysqltest --namespace MySQL --metrics_to_filter cpuUtilization.idle diskIO.readKb

You can then create alarms for these custom metrics; for more information, see Creating Amazon CloudWatch Alarms.

Note: The script doesn't create metrics for "process list", so you might need to create filters manually, depending on which process you want to display.

RDS, CloudWatch, Relational Database Service


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2017-01-09