ProxySQL Monitoring With Datadog
ProxySQL is a high performance proxy for MySQL and its forks. One of its key features is the 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. In addition, it’s 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. As a result, we get immediate and actionable insights into MySQL’s performance. Therefore, 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). It collects metrics from ProxySQL and publishes them to Datadog.
- Creating a dashboard from key metrics. It provides a good insight into the health and performance of ProxySQL.
- Writing monitors for ProxySQL based on the collected metrics. They alert when an alert condition is met.
Datadog doesn’t provide an integration for ProxySQL yet. Therefore, 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.
First, you install the TwinDB package repository for your Linux distribution. For example, if you use Debian, you can install the repository the following way:
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.
In conclusion, the Datadog agent package can be installed as follows:
apt-get install datadog-agent
Configuring the Agent to Collect ProxySQL Metrics
After you install the agent, you configure it to collect metrics.
The configuration is pretty straightforward. You can look at the configuration template as an example.
Creating the Dashboard
Once the agent has started collecting metrics, you can create the dashboard. We have published the dashboard definition as part of twindb-monitoring. Furthermore, the dashboard definition can be used to create a dashboard on Datadog. It would give you a clear insight into how ProxySQL is performing.
As you can see, using our ProxySQL agent check and the dashboard definition, it’s easy to setup comprehensive ProxySQL monitoring. Let us know if you have any questions or comments! Get back to us if you need help configuring or using the agent check, too.