---
title: ProxySQL
description: Collect your ProxySQL metrics and logs.
breadcrumbs: Docs > Integrations > ProxySQL
---

# ProxySQL
Supported OS Integration version7.6.0
## Overview{% #overview %}

This check monitors [ProxySQL](https://proxysql.com/) through the Datadog Agent.

**Minimum Agent version:** 7.19.0

## Setup{% #setup %}

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/kubernetes/integrations/) for guidance on applying these instructions.

### Installation{% #installation %}

The ProxySQL integration is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package, so you don't need to install anything else on your servers.

### Configuration{% #configuration %}

#### Enabling SSL{% #enabling-ssl %}

To connect to ProxySQL using full SSL/TLS validation, enable the `tls_verify` option in `conf.yaml`. Include certificates and passwords needed to connect with SSL/TLS.

```yaml
    tls_verify: true
    tls_ca_cert: ca_cert.pem
```

{% tab title="Host" %}
#### Host{% #host %}

To configure this check for an Agent running on a host:

1. Edit the `proxysql.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent's configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory) to start collecting your ProxySQL performance data. See the [sample proxysql.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/proxysql/datadog_checks/proxysql/data/conf.yaml.example) for all available configuration options.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent).

##### Log collection{% #log-collection %}

1. Collecting logs is disabled by default in the Datadog Agent, enable it in your `datadog.yaml` file:

   ```yaml
   logs_enabled: true
   ```

1. Add the log files you are interested in to your `proxysql.d/conf.yaml` file to start collecting your ProxySQL logs:

   ```yaml
     logs:
         # Default logging file
       - type: file
         path: /var/log/proxysql.log
         source: proxysql
         service: "<SERVICE_NAME>"
         # Logged queries, file needs to be in JSON
         # https://github.com/sysown/proxysql/wiki/Query-Logging
       - type: file
         path: "<QUERY_LOGGING_FILE_PATH>"
         source: proxysql
         service: "<SERVICE_NAME>"
         # Audit log
         # https://github.com/sysown/proxysql/wiki/Audit-log
       - type: file
         path: "<AUDIT_LOG_FILE_PATH>"
         source: proxysql
         service: "<SERVICE_NAME>"
   ```

Change the `path` and `service` parameter values and configure them for your environment. See the [sample proxysql.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/proxysql/datadog_checks/proxysql/data/conf.yaml.example) for all available configuration options.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent).

{% /tab %}

{% tab title="Containerized" %}
#### Containerized{% #containerized %}

For containerized environments, see the [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/kubernetes/integrations/) for guidance on applying the parameters below.

#### Metric collection{% #metric-collection %}

| Parameter            | Value                                                                                      |
| -------------------- | ------------------------------------------------------------------------------------------ |
| `<INTEGRATION_NAME>` | `proxysql`                                                                                 |
| `<INIT_CONFIG>`      | blank or `{}`                                                                              |
| `<INSTANCE_CONFIG>`  | `{"host": "%%host%%", "port": "%%port%%", "username": "<USER>", "password": "<PASSWORD>"}` |

##### Log collection{% #log-collection %}

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Kubernetes Log Collection](https://docs.datadoghq.com/agent/kubernetes/log/).

| Parameter      | Value                                                 |
| -------------- | ----------------------------------------------------- |
| `<LOG_CONFIG>` | `{"source": "proxysql", "service": "<SERVICE_NAME>"}` |

{% /tab %}

### Validation{% #validation %}

[Run the Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information) and look for `proxysql` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **proxysql.active\_transactions**(gauge)                   | The number of client connections currently processing a transaction.*Shown as transaction*                                                                                                     |
| **proxysql.all\_backends.count**(gauge)                    | The number of all MySQL servers, including whether they are online or not.*Shown as node*                                                                                                      |
| **proxysql.backend.query\_time\_pct**(gauge)               | Time spent (as a percentage of total time) making network calls to communicate with the backends.*Shown as percent*                                                                            |
| **proxysql.backends.count**(gauge)                         | Number of mysql servers connected.*Shown as node*                                                                                                                                              |
| **proxysql.client.connections\_aborted**(gauge)            | Client failed or improperly closed connections per second.*Shown as connection*                                                                                                                |
| **proxysql.client.connections\_connected**(gauge)          | Client connections that are currently connected.*Shown as connection*                                                                                                                          |
| **proxysql.client.connections\_created**(gauge)            | The number of client connections created per second.*Shown as connection*                                                                                                                      |
| **proxysql.client.connections\_non\_idle**(gauge)          | The number of client connections that are currently handled by the main worker threads.*Shown as connection*                                                                                   |
| **proxysql.client.statements.active\_total**(gauge)        | The number of prepared statements that are in use by clients.*Shown as unit*                                                                                                                   |
| **proxysql.client.statements.active\_unique**(gauge)       | The number of unique prepared statements currently in use by clients.*Shown as unit*                                                                                                           |
| **proxysql.frontend.user\_connections**(gauge)             | Current number of frontend connections by user.*Shown as connection*                                                                                                                           |
| **proxysql.frontend.user\_max\_connections**(gauge)        | Max number of frontend connections the user can create (as defined in mysql_users.max_connections).*Shown as connection*                                                                       |
| **proxysql.memory.auth\_memory**(gauge)                    | Memory used by the authentication module to store user credentials and attributes.*Shown as byte*                                                                                              |
| **proxysql.memory.jemalloc\_active**(gauge)                | Bytes in pages allocated by the application.*Shown as byte*                                                                                                                                    |
| **proxysql.memory.jemalloc\_allocated**(gauge)             | Bytes allocated by the application.*Shown as byte*                                                                                                                                             |
| **proxysql.memory.jemalloc\_mapped**(gauge)                | Bytes in extents mapped by the allocator.*Shown as byte*                                                                                                                                       |
| **proxysql.memory.jemalloc\_metadata**(gauge)              | Bytes dedicated to metadata.*Shown as byte*                                                                                                                                                    |
| **proxysql.memory.jemalloc\_resident**(gauge)              | Bytes in physically resident data pages mapped by the allocator.*Shown as byte*                                                                                                                |
| **proxysql.memory.jemalloc\_retained**(gauge)              | Bytes allocated by the application.*Shown as byte*                                                                                                                                             |
| **proxysql.memory.query\_digest\_memory**(gauge)           | Memory used to store data related to stats_mysql_query_digest.*Shown as byte*                                                                                                                  |
| **proxysql.memory.sqlite3\_memory\_bytes**(gauge)          | Memory used by the embedded SQLite.*Shown as byte*                                                                                                                                             |
| **proxysql.memory.stack\_memory\_admin\_threads**(gauge)   | Memory used by the stack of the admin threads.*Shown as byte*                                                                                                                                  |
| **proxysql.memory.stack\_memory\_cluster\_threads**(gauge) | Memory used by the stack of the cluster threads.*Shown as byte*                                                                                                                                |
| **proxysql.memory.stack\_memory\_mysql\_threads**(gauge)   | Memory used by the stack of the MySQL threads.*Shown as byte*                                                                                                                                  |
| **proxysql.mysql.backend\_buffers\_bytes**(gauge)          | Memory use of buffers related to backend connections.*Shown as byte*                                                                                                                           |
| **proxysql.mysql.frontend\_buffers\_bytes**(gauge)         | Memory use of buffers related to frontend connections (read/write buffers and other queues).*Shown as byte*                                                                                    |
| **proxysql.mysql.monitor\_workers**(gauge)                 | The number of monitor threads.*Shown as worker*                                                                                                                                                |
| **proxysql.mysql.session\_internal\_bytes**(gauge)         | Other memory used by ProxySQL to handle MySQL Sessions.*Shown as byte*                                                                                                                         |
| **proxysql.mysql.thread\_workers**(gauge)                  | The number of MySQL Thread workers i.e. 'mysql-threads'.*Shown as worker*                                                                                                                      |
| **proxysql.performance.command.cnt\_100ms**(count)         | The number of commands of a type which executed within 100 milliseconds., but more than 50 milliseconds*Shown as command*                                                                      |
| **proxysql.performance.command.cnt\_100us**(count)         | The number of commands of a type which executed within 100 microseconds.*Shown as command*                                                                                                     |
| **proxysql.performance.command.cnt\_10ms**(count)          | The number of commands of a type which executed within 10 milliseconds., but more than 5 milliseconds*Shown as command*                                                                        |
| **proxysql.performance.command.cnt\_10s**(count)           | The number of commands of a type which executed within 10 seconds., but more than 5 seconds*Shown as command*                                                                                  |
| **proxysql.performance.command.cnt\_1ms**(count)           | The number of commands of a type which executed within 1 milliseconds., but more than 500 microseconds*Shown as command*                                                                       |
| **proxysql.performance.command.cnt\_1s**(count)            | The number of commands of a type which executed within 1 second., but more than 500 milliseconds*Shown as command*                                                                             |
| **proxysql.performance.command.cnt\_500ms**(count)         | The number of commands of a type which executed within 500 milliseconds., but more than 100 milliseconds*Shown as command*                                                                     |
| **proxysql.performance.command.cnt\_500us**(count)         | The number of commands of a type which executed within 500 microseconds., but more than 100 microseconds*Shown as command*                                                                     |
| **proxysql.performance.command.cnt\_50ms**(count)          | The number of commands of a type which executed within 50 milliseconds., but more than 10 milliseconds*Shown as command*                                                                       |
| **proxysql.performance.command.cnt\_5ms**(count)           | The number of commands of a type which executed within 5 milliseconds., but more than 1 milliseconds*Shown as command*                                                                         |
| **proxysql.performance.command.cnt\_5s**(count)            | The number of commands of a type which executed within 5 seconds., but more than 1 second*Shown as command*                                                                                    |
| **proxysql.performance.command.cnt\_infs**(count)          | The number of commands whose execution exceeded 10 seconds.*Shown as command*                                                                                                                  |
| **proxysql.performance.command.total\_count**(count)       | The number of commands of a type executed.*Shown as command*                                                                                                                                   |
| **proxysql.performance.command.total\_time\_pct**(gauge)   | Total time spent executing commands of a type as a percentage of total time.*Shown as percent*                                                                                                 |
| **proxysql.pool.bytes\_data\_recv**(gauge)                 | The amount of data received from the backend.*Shown as byte*                                                                                                                                   |
| **proxysql.pool.bytes\_data\_sent**(gauge)                 | The amount of data sent to the backend.*Shown as byte*                                                                                                                                         |
| **proxysql.pool.conn\_failure**(gauge)                     | The number of requests per second where a connection was not available in the connection pool and either: a new connection had to be created or no backend was available.*Shown as connection* |
| **proxysql.pool.conn\_immediate**(gauge)                   | The number of connections per second that a MySQL Thread obtained from its own local connection pool cache.*Shown as connection*                                                               |
| **proxysql.pool.conn\_success**(gauge)                     | The number of requests per second where a connection was already available in the connection pool.*Shown as connection*                                                                        |
| **proxysql.pool.connections\_error**(gauge)                | How many connections aren't established successfully.*Shown as connection*                                                                                                                     |
| **proxysql.pool.connections\_free**(gauge)                 | How many connections are currently free. They are kept open in order to minimize the time cost of sending a query to the backend server.*Shown as connection*                                  |
| **proxysql.pool.connections\_ok**(gauge)                   | How many connections are established successfully.*Shown as connection*                                                                                                                        |
| **proxysql.pool.connections\_used**(gauge)                 | How many connections are currently used by ProxySQL for sending queries to the backend server.*Shown as connection*                                                                            |
| **proxysql.pool.latency\_ms**(gauge)                       | The current ping time as reported from Monitor.*Shown as millisecond*                                                                                                                          |
| **proxysql.pool.latency\_us**(gauge)                       | The current ping time as reported from Monitor.*Shown as microsecond*                                                                                                                          |
| **proxysql.pool.memory\_bytes**(gauge)                     | Memory used by the connection pool to store connections metadata.*Shown as byte*                                                                                                               |
| **proxysql.pool.queries**(gauge)                           | The number of queries routed towards this particular backend server.*Shown as query*                                                                                                           |
| **proxysql.query\_cache.bytes\_in**(gauge)                 | The number of bytes per second sent into the Query Cache.*Shown as byte*                                                                                                                       |
| **proxysql.query\_cache.bytes\_out**(gauge)                | The number of bytes per second read from the Query Cache.*Shown as byte*                                                                                                                       |
| **proxysql.query\_cache.entries**(gauge)                   | The number of entries currently stored in the query cache.*Shown as entry*                                                                                                                     |
| **proxysql.query\_cache.get.count**(gauge)                 | The number of read requests per second to the Query Cache.*Shown as query*                                                                                                                     |
| **proxysql.query\_cache.get\_ok.count**(gauge)             | The number of successful read requests per second to the Query Cache.*Shown as query*                                                                                                          |
| **proxysql.query\_cache.memory\_bytes**(gauge)             | Memory usage of the query cache.*Shown as byte*                                                                                                                                                |
| **proxysql.query\_cache.purged**(gauge)                    | The number of entries purged per second by the Query Cache due to TTL expiration.*Shown as entry*                                                                                              |
| **proxysql.query\_cache.set.count**(gauge)                 | The number of write requests per second to the Query Cache.*Shown as query*                                                                                                                    |
| **proxysql.query\_processor\_time\_pct**(gauge)            | The time (as a percentage of total time) spent inside the query processor determining the action to take with the query (internal module).*Shown as percent*                                   |
| **proxysql.query\_rules.rule\_hits**(gauge)                | The number of times query rules matched traffic.*Shown as hit*                                                                                                                                 |
| **proxysql.questions**(gauge)                              | The number of client requests / statements executed per second.*Shown as question*                                                                                                             |
| **proxysql.server.connections\_aborted**(gauge)            | Backend failed or improperly closed connections per second.*Shown as connection*                                                                                                               |
| **proxysql.server.connections\_connected**(gauge)          | Backend connections that are currently connected.*Shown as connection*                                                                                                                         |
| **proxysql.server.connections\_created**(gauge)            | The number of backend connections created per second.*Shown as connection*                                                                                                                     |
| **proxysql.server.statements.active\_total**(gauge)        | The number of prepared statements currently available across all backend connections.*Shown as unit*                                                                                           |
| **proxysql.server.statements.active\_unique**(gauge)       | The number of unique prepared statements currently available across all backend connections.*Shown as unit*                                                                                    |
| **proxysql.slow\_queries**(gauge)                          | The number of queries per second with an execution time greater than 'mysql-long_query_time' milliseconds.*Shown as query*                                                                     |
| **proxysql.statements.cached**(gauge)                      | The number of global prepared statements for which proxysql has metadata.*Shown as unit*                                                                                                       |
| **proxysql.uptime**(gauge)                                 | The total uptime of ProxySQL in seconds.*Shown as second*                                                                                                                                      |

### Events{% #events %}

The ProxySQL check does not include any events.

### Service Checks{% #service-checks %}

**proxysql.can\_connect**

Returns `CRITICAL` if the Agent can't connect to ProxySQL, otherwise returns `OK`.

*Statuses: ok, critical*

**proxysql.backend.status**

Returns `CRITICAL` if ProxySQL considers the backend host as SHUNNED or OFFLINE_HARD. Returns `WARNING` if the backend host is `OFFLINE_SOFT`. Returns `OK` otherwise.

*Statuses: ok, warning, critical*

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help).
