ProxySQL Monitoring with Datadog
ProxySQL is a high performance proxy for MySQL and its forks. One of the key features is its ability to handle hundreds of thousands of connections with very low overhead. Some of the other key features are query caching, traffic mirroring, query routing and pluggable architecture. It is also the only open source proxy that correctly handles transactions and sessions.
What is Datadog?
“Datadog is a monitoring service for cloud-scale applications, bringing together data from servers, databases, tools, and services to present a unified view of an entire stack. These capabilities are provided on a SaaS-based data analytics platform.”
We use Datadog to collect metrics of key systems of our customers. These metrics are used to analyze, alert and report on the health and performance of the MySQL infrastructure. This gives us immediate and actionable insights into MySQL’s performance. To summarize, monitoring the metrics allows us to achieve the following purposes:
- Alert us immediately when a problem arises
- Alert us on a problem that we may have in the future
Integrating Datadog with ProxySQL
There are three parts to ProxySQL-Datadog integration:
- Writing a metrics collector (Datadog calls it agent check) that collects metrics from ProxySQL and publishes them to Datadog.
- Creating a dashboard from key metrics that provides a good insight into the health and performance of ProxySQL.
- Writing monitors for ProxySQL based on the collected metrics, that alert when a alert condition is met.
Datadog does not yet provide an integration for ProxySQL. So we decided to write our own integration by forking the Datadog agent. We have a pull request open for Datadog folks. Hopefully they will merge it sometime soon.
Installing the Datadog agent
The Datadog agent with ProxySQL integration is available through TwinDB package repositories.
The first step is to install the TwinDB package repository for your Linux distribution. For example, if using Debian, the repository can be installed as follows:
curl -s https://packagecloud.io/install/repositories/twindb/main/script.deb.sh | sudo bash
Detailed instructions for installing the TwinDB repository for your Linux distribution are available here.
Then the Datadog agent package can be installed as follows:
apt-get install datadog-agent
Configuring the agent to collect ProxySQL metrics
Once the agent is installed, the next step is to configure it to collect metrics.
The configuration is pretty straight forward. You can look at the configuration template as an example.
Creating the dashboard
Once the agent has started collecting metrics, the next step is to create the dashboard. We have published the dashboard definition as part of twindb-monitoring. The dashboard definition can be used to create a dashboard on Datadog which would provide you a clear insight into how ProxySQL is performing.
As you can see that using our ProxySQL agent check and the dashboard definition, it is very easy to setup comprehensive monitoring of ProxySQL. Let us know if you have any questions or comments, or if you need help configuring or using the agent check.