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

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
N
News and Events Feed by Topic
量子位
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
Hugging Face - Blog
Hugging Face - Blog
S
Security Affairs
J
Java Code Geeks
Schneier on Security
Schneier on Security
Google Online Security Blog
Google Online Security Blog
TaoSecurity Blog
TaoSecurity Blog
小众软件
小众软件
S
SegmentFault 最新的问题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
博客园 - 聂微东
T
Tor Project blog
博客园 - Franky
C
CERT Recently Published Vulnerability Notes
Cyberwarzone
Cyberwarzone
罗磊的独立博客
博客园_首页
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
腾讯CDC
Simon Willison's Weblog
Simon Willison's Weblog
S
Securelist
博客园 - 【当耐特】
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
博客园 - 司徒正美
AWS News Blog
AWS News Blog
WordPress大学
WordPress大学
Jina AI
Jina AI
G
GRAHAM CLULEY
V
V2EX
L
LINUX DO - 最新话题
H
Heimdal Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家

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
MySQL monitoring with Datadog
John Matson · 2016-04-14 · via Datadog | The Monitor blog

This is the final post in a three-part series about MySQL monitoring. Part 1 explores the key metrics available from MySQL, and Part 2 explains how to collect those metrics.

If you’ve already read our post on collecting MySQL metrics, you’ve seen that you have several options for ad hoc performance checks. For a more comprehensive view of your database’s health and performance, however, you need a monitoring system that continually collects MySQL statistics and metrics, that lets you identify both recent and long-term performance trends, and that can help you identify and investigate issues when they arise. This post will show you how to set up comprehensive MySQL monitoring by installing the Datadog Agent on your database servers. We’ll also discuss how you can use Datadog Database Monitoring to view historical query performance metrics, explain plans, and other query-level information.

MySQL dashboard in Datadog

Integrate Datadog with MySQL

As explained in Part 1, MySQL exposes hundreds of valuable metrics and statistics about query execution and database performance. To collect those metrics on an ongoing basis, the Datadog Agent connects to MySQL at regular intervals, queries for the latest values, and reports them to Datadog for graphing and alerting.

Installing the Datadog Agent

Installing the Agent on your MySQL server is easy: it usually requires just a single command, and the Agent can collect basic metrics even if the MySQL performance schema is not enabled and the sys schema is not installed. Installation instructions for a variety of operating systems and platforms are available here.

Configure the Agent to collect MySQL metrics

Once the Agent is installed, you need to grant it access to read metrics from your database. In short, this process has four steps:

  1. Create a datadog user in MySQL and grant it permission to run metric queries on your behalf.

  2. In the conf.d/mysql.d directory, you will find a sample MySQL configuration file called conf.yaml.example. Copy this file to conf.yaml.

  3. Add the login credentials for your newly created datadog user to conf.yaml.

  4. Restart the Agent.

The MySQL configuration tile in the Datadog app has the full instructions, including the exact SQL commands you need to run to create the datadog user and apply the appropriate permissions.

Configure collection of additional MySQL metrics

Out of the box, Datadog collects more than 60 standard metrics from modern versions of MySQL. Definitions and measurement units for most of those standard metrics can be found here.

Starting with Datadog Agent version 5.7, many additional metrics are available by enabling specialized checks in the mysql.d/conf.yaml file (see the example configuration template for context):

# options:

# replication: false

# replication_channel: <CHANNEL_NAME>

# replication_non_blocking_status: false

# galera_cluster: false

# extra_status_metrics: true

# extra_innodb_metrics: true

# extra_performance_metrics: true

# schema_size_metrics: false

# disable_innodb_metrics: false

To collect average statistics on query latency, as described in Part 1 of this series, you will need to enable the extra_performance_metrics option and ensure that the performance schema is enabled. The Agent’s datadog user in MySQL will also need the additional permissions detailed in the MySQL configuration instructions in the Datadog app.

Monitor the health and performance of your MySQL databases with Datadog.

Note that the extra_performance_metrics and schema_size_metrics options trigger heavier queries against your database, so you may be subject to performance impacts if you enable those options on servers with a large number of schemas or tables. Therefore you may wish to test out these options on a limited basis before deploying them to production.

Other options include:

  • extra_status_metrics to expand the set of server status variables reported to Datadog

  • extra_innodb_metrics to collect more than 80 additional metrics specific to the InnoDB storage engine

  • replication to collect basic metrics (such as replica lag) on MySQL replicas

To override default behavior for any of these optional checks, simply uncomment the relevant lines of the configuration file (along with the options: line) and restart the Agent.

The specific metrics associated with each option are detailed in the source code for the MySQL Agent check.

View your comprehensive MySQL dashboard

MySQL dashboard in Datadog

Once you have integrated Datadog with MySQL, a comprehensive dashboard called “MySQL - Overview” will appear in your list of integration dashboards. The dashboard gathers key MySQL metrics highlighted in Part 1 of this series, along with server resource metrics, such as CPU and I/O wait, which are invaluable for investigating performance issues.

Customize your dashboard

The Datadog Agent can also collect metrics from the rest of your infrastructure so that you can correlate your entire system’s performance with metrics from MySQL. The Agent collects metrics from Docker, NGINX, Redis, and more than 1,000 other applications and services. You can also easily instrument your own application code to report custom metrics to Datadog using StatsD.

To add more metrics from MySQL or related systems to your MySQL dashboard, simply clone the template dashboard by clicking on the gear in the upper right.

Get query-level insights with Datadog Database Monitoring

Datadog Database Monitoring (DBM) helps you get even deeper visibility into your MySQL databases by providing historical query performance metrics, explain plans, host-level metrics, and more. Getting up and running with DBM requires just a few additional configuration steps, which you can find in our documentation.

Once you’ve enabled DBM, simply navigate to the Databases view to begin monitoring the performance of normalized queries across all of your databases. As shown in the screenshot below, you can sort your normalized queries by key statistics, such as the number of executions, average execution time, and the number of rows returned, which can help surface inefficiencies.

Track the performance of normalized queries in Datadog Database Monitoring

You can click on any problematic query to open the Query Details panel, which includes a wealth of information that can help with troubleshooting. For instance, you can examine the query’s explain plans, which are step-by-step breakdowns of how the query planner has decided to execute it. Explain plans show you which steps are the most expensive, so you can pinpoint areas of your code in need of optimization. The Query Details panel also includes timeseries graphs of the query’s performance metrics, which allow you to monitor trends over the long term and alert on anomalous behavior.

Read our dedicated blog post to learn more about DBM.

Surface inefficient queries with Datadog Database Monitoring.

Tracing MySQL queries with APM

Datadog APM traces requests as they propagate across services and infrastructure boundaries, and generates statistics about your application’s throughput, errors, and latency. From APM, you can easily pivot to related metrics and logs for additional context when troubleshooting your application.

As of Agent 5.13+, distributed tracing is enabled by default. Adding an environment tag to your Agent APM configuration can help you better organize and locate your APM data as it flows into Datadog. To do this, navigate to the apm_config section of the Agent configuration file (datadog.yaml) and include the env tag:

## Trace Collection Configuration ##

apm_config:

enabled: true

env: staging

The example here tags APM data with env:staging. If you omit this, Datadog will default to env:none. Save the file and restart the Agent to apply your changes.

Auto-instrument your application for tracing

Datadog APM supports auto-instrumentation for popular languages, libraries, and frameworks so you can start tracing with minimal configuration. In this section, we’ll show you how to set up APM to trace requests to MySQL within a Ruby on Rails application.

First, add the ddtrace gem to the Gemfile of your Rails application.

Then, install it with bundler.

Next, add a datadog.rb initializer file to your application’s config/initializers directory to auto-instrument your application:

Datadog.configure do |c|

c.use :rails, service_name: 'email-service', database_service: 'email-service-db'

end

Save the initializer file and run your application.

View MySQL traces and query statistics

Within a few minutes, you should see the main Rails application (email-service) and MySQL database (email-service-db) service appear in Datadog APM. If you navigate to the service-level dashboard for email-service-db, you will see an overview of key performance indicators such as throughput, latency, and error rate. These graphs can be added to any other dashboard, making it easy to correlate these metrics with data from other parts of your infrastructure when troubleshooting a complex issue.

The MySQL database dashboard displays an overview of key performance statistics, such as total requests, errors, and latency.

Datadog APM is also equipped with Watchdog, a machine learning-powered engine that automatically detects anomalies across your environment without any manual setup. In our case, we see that Watchdog discovered a sudden spike in errors from our database over a two-hour period. You can then enable an alert to automatically notify you if your application behaves similarly in the future.

This Watchdog story shows that the error rate of our database service was abnormally high for 2 hours.

In addition, you can click anywhere on the spike to pivot to related traces—and inspect one in more detail. Each trace is visualized as a flame graph that breaks down how long the request spent in each service it accessed. In the example below, we can see the 5xx errors Watchdog detected were mainly a result of MySQL attempting to insert entries into a table that does not exist.

By inspecting an individual trace, we can see that a query to insert values into a table that does not exist triggered a 500 error

Datadog automatically correlates all the logs and the trace for each request, so you can get rich context for investigating issues. In the next section, we will walk through how you can forward logs to Datadog.

Dive deeper into MySQL with logs

Sending logs from MySQL to Datadog involves making just a few simple changes to your configuration.

Set up MySQL log collection

We will configure MySQL to collect three types of logs: error, general, and slow query logs. If you’re using a Unix or Unix-like system, you will first need to comment out or remove syslog from /etc/mysql/conf.d/mysqld_safe_syslog.cnf, as error logs are sent to the system log by default. For all other operating systems, you can skip this step.

To enable logging, add the following lines to your MySQL configuration file (my.cnf):

[mysqld_safe]

log_error = /var/log/mysql/mysql_error.log

[mysqld]

general_log = on

general_log_file = /var/log/mysql/mysql.log

log_error = /var/log/mysql/mysql_error.log

slow_query_log = on

slow_query_log_file = /var/log/mysql/mysql_slow.log

long_query_time = 2

Save the file and restart MySQL.

Next, include the following information in mysql.d/conf.yaml to configure the Agent to collect MySQL error, general, and slow query logs, based on the file paths specified in your MySQL configuration file:

logs:

- type: file

path: /var/log/mysql/mysql_error.log

service: email-service

source: mysql

- type: file

path: /var/log/mysql/mysql_slow.log

service: email-service

source: mysql

log_processing_rules:

- type: multi_line

name: new_slow_query_log_entry

pattern: "# Time:"

# If mysqld was started with `--log-short-format`, use:

# pattern: "# Query_time:"

- type: file

path: /var/log/mysql/mysql.log

service: email-service

source: mysql

In this example, we defined a custom log processing rule that instructs Datadog to report each multi-line slow query log as a single entry, rather than spreading it across multiple entries. Datadog scans your raw logs for the specified pattern and aggregates all subsequent lines into a single log message until it encounters the pattern again.

Finally, set the logs_enabled parameter to true in your Agent configuration file:

## Log collection Configuration ##

logs_enabled: true

Restart the Agent to apply your changes. You should now begin to see MySQL application logs appearing in your Log Explorer.

Explore MySQL logs in Datadog

Datadog automatically installs the log processing pipeline for the integration specified in the source parameter (mysql, in this case) and extracts facets and attributes that you can use to search, filter, and sort through your logs. Likewise, using the same service tag you configured earlier in APM enables you to seamlessly pivot from logs to application-level metrics and request traces and get rich context for troubleshooting issues.

To display only logs from your service, search for service:email-service or filter using the service name facet in the sidebar of the Log Explorer. If you click on the Log Patterns button in the upper-left corner of the Log Explorer, the full list of logs collapses into clusters based on their common patterns. When you’re investigating an issue, these patterns can help you easily identify unusual occurrences and focus on specific problem areas—without having to sift through massive volumes of logs.

Navigate to Log Patterns to see clusters of logs based on common patterns and use it as a jumping-off point for an investigation

Clicking on any cluster shows you all the individual logs that match the pattern. From within a log, you can jump to a dashboard of the log’s host by clicking on the host name at the top of the log. You can also see related performance statistics and request traces by clicking on the service name and pivoting to APM.

This log shows that a connection to the database was aborted because there was an error reading communication packets.

With metrics, traces, and logs all in one place, you now have the deep visibility you need to resolve any issues that arise.

Start monitoring MySQL with Datadog

In this post, we’ve walked you through integrating MySQL with Datadog so you can access all your database metrics in one place, whether standard metrics from MySQL, more detailed metrics from the InnoDB storage engine, or automatically computed metrics on query latency. In addition, we’ve shown you how you can collect distributed traces and logs to troubleshoot performance issues with even greater context.

Monitoring MySQL with Datadog gives you critical visibility into what’s happening with your database and the applications that depend on it. You can easily create automated alerts on any metric, with triggers tailored precisely to your infrastructure and your usage patterns.

If you don’t yet have a Datadog account, you can sign up for a free trial to start monitoring all your servers, applications, and services today.