Set up MySQL monitoring using the NRDOT Collector for AWS RDS MySQL instances. RDS environments have specific considerations for Performance Schema consumers and privileges.
Guided installation
To install through the New Relic UI instead, go to one.newrelic.com > Integrations & Agents > MySQL (Database 360) . This page covers manual installation only.
Prerequisites
Before you install, make sure you have:
- A New Relic license key.
- Network connectivity between the host where you install the NRDOT Collector and your RDS MySQL instance.
- Network connectivity to New Relic OTLP endpoints documentation
- RDS master user credentials.
For supported MySQL versions, required grants, and performance_schema requirements, see Compatibility and prerequisites.
Set up NRDOT Collector
Install the NRDOT Collector on a system that can connect to your RDS instance:
Configure database user
Create a monitoring user with the necessary privileges for your RDS MySQL instance.
To create a monitoring user, connect to your RDS instance as the master user and run:
CREATE USER '<YOUR_DB_USERNAME>'@'%' IDENTIFIED BY '<YOUR_DB_PASSWORD>';To collect query samples and top queries, grant the following privileges to the monitoring user:
GRANT SELECT ON performance_schema.* TO '<YOUR_DB_USERNAME>'@'%';GRANT SELECT ON *.* TO '<YOUR_DB_USERNAME>'@'%';GRANT REPLICATION CLIENT ON *.* TO '<YOUR_DB_USERNAME>'@'%';GRANT PROCESS ON *.* TO '<YOUR_DB_USERNAME>'@'%';(Optional) To view the wait-time data in New Relic platform, grant the following privileges to the monitoring user:
GRANT UPDATE ON performance_schema.setup_consumers TO '<YOUR_DB_USERNAME>'@'%';팁
This setting doesn't persist on RDS; the
events_waits_currentconsumer resets on every restart or failover. Granting this privilege lets the collector automatically re-enable it on reconnect; otherwise you'll need to re-run the enable statement after every restart.(Optional) To verify the connection and grants, run:
bash$mysql -h <YOUR_DB_HOST> -P <YOUR_DB_PORT> -u <YOUR_DB_USERNAME> -p -e "SELECT 1;"If the command completes without an error, the monitoring user, host, and port are all correct.
Configure NRDOT Collector
Configure the NRDOT Collector with your MySQL-specific settings.
This configuration focuses on essential MySQL monitoring with the nrmysql receiver only.
full configuration
This baseline configuration captures essential metrics. To see the complete metric catalog, refer to the configuration reference.
Create a configuration file named
mysql-config.yaml:bash$sudo nano /etc/nrdot-collector/mysql-config.yamlAdd the following configuration to the
mysql-config.yamlfile you created in the previous step:
1receivers:2 nrmysql:3 endpoint: "mydb-instance.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com:3306"4 transport: tcp5 username: "newrelic"6 password: "YOUR_PASSWORD"7 allow_native_passwords: true8 collection_interval: 15s9 initial_delay: 1s10 explain_mode: procedure11 statement_events:12 digest_text_limit: 409613 time_limit: 24h14 limit: 50015 query_sample_collection:16 max_rows_per_query: 10017 allowed_comment_keys: [nr_service_guid]18 top_query_collection:19 lookback_time: 6020 max_query_sample_count: 500021 top_query_count: 20022 collection_interval: 60s23 query_plan_cache_size: 100024 query_plan_cache_ttl: 1h25 allowed_comment_keys: [nr_service_guid]26 events:27 db.server.query_sample:28 enabled: true29 db.server.top_query:30 enabled: true31 db.server.query_plan:32 enabled: true33 resource_attributes:34 db.system.version:35 enabled: true36 metrics:37 mysql.query.count:38 enabled: true39 mysql.query.slow.count:40 enabled: true41 mysql.commands:42 enabled: true43 mysql.innodb.data_file.io:44 enabled: true45
46processors:47 batch:48
49exporters:50 otlp/newrelic:51 endpoint: "https://otlp.nr-data.net:4318"52 headers:53 api-key: "YOUR_LICENSE_KEY"54 compression: gzip55 retry_on_failure:56 enabled: true57 initial_interval: 5s58 max_interval: 30s59 max_elapsed_time: 300s60
61service:62 pipelines:63 metrics:64 receivers: [nrmysql]65 processors: [batch]66 exporters: [otlp/newrelic]67 logs:68 receivers: [nrmysql]69 processors: [batch]70 exporters: [otlp/newrelic]팁
This configuration omits the optional database and tls fields. By default, the receiver monitors every database the monitoring user can access, and connects without TLS. Most Amazon RDS/Aurora instances enforce SSL/TLS, so you'll likely need to enable it. See Enable detailed insights for the tls block and ca_file setup.
Configuration parameters
The following table describes the key configuration parameters for the nrmysql receiver:
| Parameter | Description |
|---|---|
<YOUR_NEWRELIC_OTLP_ENDPOINT> | Enter the New Relic OTLP endpoint. For more information, see New Relic OTLP endpoints. |
<YOUR_NEWRELIC_LICENSE_KEY> | Enter your New Relic license key. |
transport | Default value is set to tcp to connect over the network. |
collection_interval | Enter the interval between metric scrapes. Default: 15s. |
explain_mode | Default value is set to inline. Set the value to procedure to collect query plans for write statements without granting DML privileges to the monitoring user. See Query plans for write statements. |
Validate NRDOT Collector configuration
Update the config path to point to your new
mysql-config.yamlfile:bash$sudo sed -i 's|OTELCOL_OPTIONS="--config=/etc/nrdot-collector/config.yaml"|OTELCOL_OPTIONS="--config=/etc/nrdot-collector/mysql-config.yaml"|' /etc/nrdot-collector/nrdot-collector.confValidate the NRDOT Collector configuration to ensure it's correctly formatted and will work properly:
bash$sudo /usr/bin/nrdot-collector validate --config=/etc/nrdot-collector/mysql-config.yaml팁
You can also:
- Configure multiple receivers: To monitor multiple MySQL instances from one collector.
- Link your MySQL database with APM: To correlate your application performance with database operations. This allows you to see exactly which applications are generating specific database workloads.
- Set up secret management: To securely manage sensitive information, such as database credentials. This helps to enhance the security of your monitoring setup by avoiding hardcoding sensitive data in configuration files.
Restart NRDOT Collector
After updating your configuration, restart the NRDOT Collector service:
bash$sudo systemctl restart nrdot-collector팁
Always restart the NRDOT Collector service after making configuration changes to ensure the new settings take effect.
To verify that the collector is running properly, check the service status:
bash$sudo systemctl status nrdot-collector
Find and use your data
Once your data is being collected, you can access comprehensive RDS MySQL database monitoring through the New Relic UI.
To find your RDS MySQL database entity in New Relic:
- Go to https://one.newrelic.com > All Capabilities > Databases.
- From the Entity type dropdown, select MySQL instance, then click Apply.
- Select your RDS MySQL database from the list of entities.
Limitations
The events_waits_current Performance Schema consumer is required for mysql.events_waits_current.timer_wait and wait-based dashboards. The mysql8.0 RDS parameter group family doesn't expose performance_schema_consumer_* parameters, preventing persistent configuration. This consumer must be enabled at runtime, as the setting resets after every database restart or failover.