Preview
We're still working on this feature, but we'd love for you to try it out!
This feature is currently provided as part of a preview pursuant to our pre-release policies.
Set up MySQL monitoring using the NRDOT Collector on self-hosted environments including physical servers, virtual machines, and standalone installations.
Prerequisites
Before you install, make sure you have:
- A New Relic license key.
- Administrative access to your MySQL instance.
- Network connectivity between the host where you install the NRDOT Collector and your MySQL database.
- Network connectivity to New Relic OTLP endpoints documentation
- This integration is available as a part of New Relic public preview program. Check with your Organization Manager to opt in from the Previews & Trials page.
For supported MySQL versions, required grants, and performance_schema requirements, see Compatibility and prerequisites.
Set up NRDOT Collector
Install the NRDOT Collector on your system:
Configure database user
Create a monitoring user with the necessary privileges for your MySQL database instance.
To create a monitoring user, run the following command in your MySQL database:
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>'@'%';(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>'@'%';(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. Select your configuration type based on your monitoring needs:
Configuration parameters
The following table describes the key configuration parameters for the nrmysql receiver:
| Parameter | Description |
|---|---|
<YOUR_DB_HOST> | Enter your MySQL host name or IP address. |
<YOUR_DB_PORT> | Enter your MySQL port number. The default value is 3306. |
<YOUR_DB_USERNAME> | Enter the username of the monitoring user you created in Configure database user. |
<YOUR_DB_PASSWORD> | Enter the password of the monitoring user you created in Configure database user. |
<YOUR_DATABASE_NAME> | Optional. Enter a specific database name to restrict monitoring to it. Omit this parameter to monitor every database the monitoring user can access. |
<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. If your NRDOT Collector runs on the same host as MySQL, use unix to connect through a Unix domain socket instead. |
collection_interval | Enter the interval between metric scrapes. Default: 10s. |
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$OTELCOL_OPTIONS="/etc/nrdot-collector/mysql-config.yaml"Validate 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
Tip
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:
$sudo systemctl restart nrdot-collectorTip
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:
$sudo systemctl status nrdot-collectorFind and use your data
Once your data is being collected, you can access comprehensive MySQL database monitoring through New Relic's UI.
To find your 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 MySQL database from the list of entities.
After setting up MySQL database monitoring with NRDOT:
- Create custom dashboards to visualize your database metrics
- Set up alerts for critical database performance thresholds