惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
MyScale Blog
MyScale Blog
Y
Y Combinator Blog
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
N
News and Events Feed by Topic
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
博客园 - 叶小钗
B
Blog
Vercel News
Vercel News
T
Tenable Blog
T
The Exploit Database - CXSecurity.com
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Security Blog
Microsoft Security Blog
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
G
GRAHAM CLULEY
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Check Point Blog
A
About on SuperTechFans
W
WeLiveSecurity
The GitHub Blog
The GitHub Blog

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
How to collect RDS MySQL metrics
John Matson · 2015-10-20 · via Datadog | The Monitor blog

This post is part 2 of a 3-part series on monitoring MySQL on Amazon RDS. Part 1 explores the key performance metrics of RDS and MySQL, and Part 3 describes how you can use Datadog to get a full view of your MySQL instance.

As covered in Part 1 of this series, MySQL on RDS users can access RDS metrics via Amazon CloudWatch and native MySQL metrics from the database instance itself. Each metric type gives you different insights into MySQL performance; ideally both RDS and MySQL metrics should be collected for a comprehensive view. This post will explain how to collect both metric types.

Collecting RDS metrics

Standard RDS metrics can be accessed from CloudWatch in three main ways:

  • Using the AWS Management Console and its web interface

  • Using the command line interface

  • Using a monitoring tool with a CloudWatch integration

Using the AWS Console

Using the online management console is the simplest way to monitor RDS with CloudWatch. The AWS Console allows you to set up simple automated alerts and get a visual picture of recent changes in individual metrics.

Graphs

Once you are signed in to your AWS account, you can open the CloudWatch console where you will see the metrics related to the different AWS services.

By selecting RDS from the list of services and clicking on “Per-Database Metrics,” you will see your database instances, along with the available metrics for each:

metric-list-2

Just select the checkbox next to the metrics you want to visualize, and they will appear in the graph at the bottom of the console.

metric-graph

Alerts

With the CloudWatch console you can also create alerts that trigger when a metric threshold is crossed.

To set up an alert, click on the “Create Alarm” button at the right of your graph and configure the alarm to notify a list of email addresses:

metric-alarm

Using the command line interface

You can also retrieve metrics related to your database instance using the command line. Command line queries can be useful for spot checks and ad hoc investigations. To do so, you will need to install and configure the AWS command line interface. You will then be able to query for any CloudWatch metrics you want, using different filters.

For example, if you want to check the CPUUtilization metric across a five-minute window on your MySQL instance, you can run:

aws cloudwatch get-metric-statistics --namespace AWS/RDS --metric-name CPUUtilization --dimensions Name=DBInstanceIdentifier,Value=<YOUR_INSTANCE_NAME> --statistics=Maximum --start-time 2019-10-03T21:00:00 --end-time 2019-10-03T21:05:00 --period=60

Here is an example of the output returned from a get-metric-statistics query like the one above:

{

"Label": "CPUUtilization",

"Datapoints": [

{

"Timestamp": "2019-10-03T21:00:00Z",

"Maximum": 2.20338983050847,

"Unit": "Percent"

},

{

"Timestamp": "2019-10-03T21:01:00Z",

"Maximum": 1.50000000000001,

"Unit": "Percent"

},

{

"Timestamp": "2019-10-03T21:02:00Z",

"Maximum": 1.49999999999999,

"Unit": "Percent"

},

{

"Timestamp": "2019-10-03T21:03:00Z",

"Maximum": 1.50000000000001,

"Unit": "Percent"

},

{

"Timestamp": "2019-10-03T21:04:00Z",

"Maximum": 1.66666666666667,

"Unit": "Percent"

}

]

}

Full usage details for the get-metric-statistics command are available in the AWS documentation.

Using a monitoring tool with a CloudWatch integration

The third way to collect CloudWatch metrics is via your own monitoring tools, which can offer extended monitoring functionality. For instance, if you want to correlate metrics from your database with other parts of your infrastructure (including the applications that depend on that database), or you want to dynamically slice, aggregate, and filter your metrics on any attribute, or you need dynamic alerting mechanisms, you probably need a dedicated monitoring system. Monitoring tools that seamlessly integrate with the CloudWatch API can, with a single setup process, collect metrics from across your AWS infrastructure.

In Part 3 of this series, we walk through how you can easily collect, visualize, and alert on any RDS metric using Datadog.

Collecting native MySQL metrics

CloudWatch offers several high-level metrics for any database engine, but to get a deeper look at MySQL performance you will need metrics from the database instance itself. Here we will focus on four methods for metric collection:

  • Querying server status variables

  • Querying the performance schema and sys schema

  • Using the MySQL Workbench GUI

  • Using a MySQL monitoring tool

Querying server status variables

Connecting to your RDS instance

With RDS you cannot directly access the machines running MySQL. So you cannot run mysql commands locally or pull CPU utilization metrics directly from the machine itself, as you could if you installed MySQL yourself on a standalone EC2 instance. That said, you can connect to your MySQL instance remotely using standard tools, provided that the security group for your MySQL instance permits connections from the device or EC2 instance you are using to initiate the connection.

ssh-to-rds

For example, if your RDS MySQL instance accepts traffic only from inside its security group, you can launch an EC2 instance in that security group, and then apply a second security group rule to the EC2 instance to accept inbound SSH traffic (see diagram above). Then you can SSH to the EC2 instance, from which you can connect to MySQL using the mysql command line tool:

mysql -h instance-name.xxxxxx.us-east-1.rds.amazonaws.com -P 3306 -u yourusername -p

The instance endpoint (ending in rds.amazonaws.com) can be found in the list of instances on the RDS console.

Once you connect to your database instance, you can query any of the hundreds of available MySQL metrics, known as server status variables. To check metrics on connection errors, for instance:

mysql> SHOW GLOBAL STATUS LIKE '%Connection_errors%';

Querying the performance schema and sys schema

Server status variables by and large capture high-level server activity. To collect metrics at the query level, such as query latency and query errors, you can use the MySQL performance schema, which captures detailed statistics on server events.

Enabling the performance schema

To enable the performance schema, you must set the performance_schema parameter to 1 in the database instance’s parameter group using the AWS console. This change requires an instance reboot.

Once it is enabled, the performance schema will collect metrics on all the statements executed by the server. Many of those metrics are summarized in the events_statements_summary_by_digest table, available in MySQL 5.6 and later. The digest normalizes all the statements, ignoring data values and standardizing whitespace, so that the following two queries would be considered the same:

SELECT * FROM orders WHERE customer_id=10 AND quantity>20

SELECT * FROM orders WHERE customer_id = 25 AND quantity > 100

The performance schema captures information about latency, errors, and query volume for each normalized statement. A sample row from the events_statements_summary_by_digest table shows an expensive query that takes multiple seconds to execute (all timer measurements are in picoseconds):

*************************** 1. row ***************************

SCHEMA_NAME: employees

DIGEST: 5f56800663c86bf3c24239c1fc1edfcb

DIGEST_TEXT: SELECT * FROM `employees` . `salaries`

COUNT_STAR: 2

SUM_TIMER_WAIT: 4841460833000

MIN_TIMER_WAIT: 1972509586000

AVG_TIMER_WAIT: 2420730416000

MAX_TIMER_WAIT: 2868951247000

SUM_LOCK_TIME: 1101000000

SUM_ERRORS: 0

SUM_WARNINGS: 0

SUM_ROWS_AFFECTED: 0

SUM_ROWS_SENT: 5688094

SUM_ROWS_EXAMINED: 5688094

SUM_CREATED_TMP_DISK_TABLES: 0

SUM_CREATED_TMP_TABLES: 0

SUM_SELECT_FULL_JOIN: 0

SUM_SELECT_FULL_RANGE_JOIN: 0

SUM_SELECT_RANGE: 0

SUM_SELECT_RANGE_CHECK: 0

SUM_SELECT_SCAN: 2

SUM_SORT_MERGE_PASSES: 0

SUM_SORT_RANGE: 0

SUM_SORT_ROWS: 0

SUM_SORT_SCAN: 0

SUM_NO_INDEX_USED: 2

SUM_NO_GOOD_INDEX_USED: 0

FIRST_SEEN: 2015-09-25 19:57:25

LAST_SEEN: 2015-09-25 19:59:39

Using the sys schema

Though the performance schema can be queried directly, it is usually easier to extract meaningful views of the data using the sys schema, which provides a number of useful tables, functions, and procedures for parsing your data.

To install the sys schema, first clone the mysql-sys GitHub repo to the machine that you use to connect to your MySQL instance (e.g., an EC2 instance in the same security group) and position yourself within the newly created directory:

git clone https://github.com/MarkLeith/mysql-sys.git

cd mysql-sys

Then, run a shell script within the mysql-sys repo that creates an RDS-compatible file for the sys schema. For MySQL version 5.6, the command and output looks like:

$ ./generate_sql_file.sh -v 56 -b -u CURRENT_USER

Wrote file: /home/ec2-user/mysql-sys/gen/sys_1.5.0_56_inline.sql

Object Definer: CURRENT_USER

sql_log_bin: disabled

Finally, you must load the newly created file into MySQL, using the filename returned in the step above:

mysql -h instance-name.xxxxxx.us-east-1.rds.amazonaws.com -P 3306 -u yourusername -p < gen/sys_1.5.0_56_inline.sql

Now, when you access your database instance using the mysql command line tool, you will have access to the sys schema and all the views within. The sys schema documentation provides information on the various tables and functions, along with a number of useful examples. For instance, to summarize all the statements executed, along with their associated latencies:

mysql> select * from sys.user_summary_by_statement_type;

+----------+--------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+

| user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans |

+----------+--------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+

| gobby | create_view | 87 | 490.62 ms | 6.74 ms | 9.78 ms | 0 | 0 | 0 | 0 |

| gobby | create_procedure | 26 | 80.58 ms | 9.16 ms | 9.06 ms | 0 | 0 | 0 | 0 |

| gobby | drop_procedure | 26 | 51.71 ms | 2.76 ms | 1.01 ms | 0 | 0 | 0 | 0 |

| gobby | create_function | 20 | 49.57 ms | 3.34 ms | 2.20 ms | 0 | 0 | 0 | 0 |

| gobby | drop_function | 20 | 38.84 ms | 2.20 ms | 889.00 us | 0 | 0 | 0 | 0 |

| gobby | create_table | 1 | 20.28 ms | 20.28 ms | 0 ps | 0 | 0 | 0 | 0 |

| gobby | create_trigger | 2 | 15.66 ms | 8.07 ms | 323.00 us | 0 | 0 | 0 | 0 |

| gobby | drop_trigger | 2 | 4.54 ms | 2.57 ms | 0 ps | 0 | 0 | 0 | 0 |

| gobby | insert | 1 | 4.29 ms | 4.29 ms | 197.00 us | 0 | 0 | 5 | 0 |

| gobby | create_db | 1 | 3.10 ms | 3.10 ms | 0 ps | 0 | 0 | 1 | 0 |

| gobby | show_databases | 3 | 841.59 us | 351.89 us | 268.00 us | 17 | 17 | 0 | 3 |

| gobby | select | 5 | 332.27 us | 92.61 us | 0 ps | 5 | 0 | 0 | 0 |

| gobby | set_option | 5 | 182.79 us | 43.50 us | 0 ps | 0 | 0 | 0 | 0 |

| gobby | Init DB | 1 | 19.82 us | 19.82 us | 0 ps | 0 | 0 | 0 | 0 |

| gobby | Quit | 2 | 15.26 us | 11.95 us | 0 ps | 0 | 0 | 0 | 0 |

+----------+--------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+

Using the MySQL Workbench GUI

MySQL Workbench is a free application with a GUI for managing and monitoring a MySQL instance. MySQL Workbench provides a high-level performance dashboard, as well as an easy-to-use interface for browsing performance metrics (using the views provided by the sys schema).

workbench-2
workbench-2

If you have configured an EC2 instance to communicate with MySQL running on RDS, you can connect MySQL Workbench to your MySQL on RDS via SSH tunneling:

ssh-tunneling-2

You can then view recent metrics on the performance dashboard or click through the statistics available from the sys schema:

95th-percentile-2
95th-percentile-2

Using a MySQL monitoring tool

The fourth way to access MySQL’s native metrics is to use a full-featured monitoring tool that integrates with MySQL. Such tools allow you to not only glimpse a real-time snapshot of your metrics but to visualize and analyze your metrics’ evolution over time, and to set alerts to be notified when key metrics go out of bounds. Comprehensive monitoring tools also allow you to correlate your metrics across systems, so you can quickly determine if errors from your application can be traced back to MySQL, or if increased MySQL latency is caused by system-level resource contention. Part 3 of this series demonstrates how you can set up comprehensive monitoring of MySQL on RDS with Datadog.

Conclusion

In this post we have walked through how to use CloudWatch to collect and visualize standard RDS metrics, and how to generate alerts when these metrics go out of bounds. We’ve also shown you how to collect more detailed metrics from MySQL itself, whether on an ad hoc or continuous basis.

In the next and final part of this series, we’ll show you how you can set up Datadog to collect, visualize, and set alerts on metrics from both RDS and MySQL.

Acknowledgments

We are grateful to have had input on this series from Baron Schwartz, whose company VividCortex provides a query-centric view of database performance.