ProxySQL
セキュリティモニタリングが使用可能です セキュリティモニタリングが使用可能です

ProxySQL

Agent Check Agentチェック

Supported OS: Linux Mac OS Windows

概要

このチェックは、Datadog Agent を通じて ProxySQL を監視します。

セットアップ

ホストで実行されている Agent 用にこのチェックをインストールおよび構成する場合は、以下の手順に従ってください。コンテナ環境の場合は、オートディスカバリーのインテグレーションテンプレートのガイドを参照してこの手順を行ってください。

インストール

ProxySQL インテグレーションは Datadog Agent パッケージに含まれています。サーバーに追加でインストールする必要はありません。

コンフィギュレーション

ホスト

  1. ProxySQL のパフォーマンスデータの収集を開始するには、Agent のコンフィギュレーションディレクトリ のルートにある conf.d/ フォルダーの proxysql.d/conf.yaml ファイルを編集します。使用可能なすべてのコンフィギュレーションオプションについては、サンプル proxysql.d/conf.yaml を参照してください。

  2. Agent を再起動します

ログの収集
  1. Datadog Agent で、ログの収集はデフォルトで無効になっています。以下のように、datadog.yaml ファイルでこれを有効にします。

    logs_enabled: true
  2. ProxySQL のログの収集を開始するには、該当のログファイルを proxysql.d/conf.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>"

    path パラメーターと service パラメーターの値を変更し、環境に合わせて構成してください。使用可能なすべてのコンフィギュレーションオプションについては、サンプル proxysql.d/conf.yaml を参照してください。

  3. Agent を再起動します

コンテナ化

コンテナ環境の場合は、オートディスカバリーのインテグレーションテンプレートのガイドを参照して、次のパラメーターを適用してください。

メトリクスの収集

パラメーター
<インテグレーション名>proxysql
<初期コンフィギュレーション>空白または {}
<インスタンスコンフィギュレーション>{"host": "%%host%%", "port": "%%port%%", "username": "<ユーザー>", "password": "<パスワード>"}
ログの収集

Datadog Agent では、ログの収集はデフォルトで無効になっています。有効にする方法については、Kubernetes ログ収集のドキュメントを参照してください。

パラメーター
<LOG_CONFIG>{"source": "proxysql", "service": "<サービス名>"}

検証

Agent の status サブコマンドを実行し、Checks セクションで proxysql を探します。

収集データ

メトリクス

proxysql.active_transactions
(gauge)
The number of client connections currently processing a transaction.
Shown as transaction
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.questions
(gauge)
The number of client requests / statements executed per second.
Shown as question
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.uptime
(gauge)
The total uptime of ProxySQL in seconds.
Shown as second
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.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.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.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.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.mysql.monitor_workers
(gauge)
The number of monitor threads.
Shown as worker
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.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.memory_bytes
(gauge)
Memory used by the connection pool to store connections metadata.
Shown as byte
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.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.statements.cached
(gauge)
The number of global prepared statements for which proxysql has metadata.
Shown as unit
proxysql.query_cache.entries
(gauge)
The number of entries currently stored in the query cache.
Shown as entry
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.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.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.set.count
(gauge)
The number of write requests per second to the Query Cache.
Shown as query
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.performance.command.total_count
(count)
The number of commands of a type executed.
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_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_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_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_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_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_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_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_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_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_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_infs
(count)
The number of commands whose execution exceeded 10 seconds.
Shown as command
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.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_error
(gauge)
How many connections aren't established successfully.
Shown as connection
proxysql.pool.queries
(gauge)
The number of queries routed towards this particular backend server.
Shown as query
proxysql.pool.bytes_data_sent
(gauge)
The amount of data sent to the backend.
Shown as byte
proxysql.pool.bytes_data_recv
(gauge)
The amount of data received from the backend.
Shown as byte
proxysql.pool.latency_ms
(gauge)
The current ping time as reported from Monitor.
Shown as millisecond
proxysql.memory.sqlite3_memory_bytes
(gauge)
Memory used by the embedded SQLite.
Shown as byte
proxysql.memory.jemalloc_resident
(gauge)
Bytes in physically resident data pages mapped by the allocator.
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_retained
(gauge)
Bytes allocated by the application.
Shown as byte
proxysql.memory.auth_memory
(gauge)
Memory used by the authentication module to store user credentials and attributes.
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.stack_memory_mysql_threads
(gauge)
Memory used by the stack of the MySQL threads.
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.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.query_rules.rule_hits
(gauge)
The number of times query rules matched traffic.
Shown as hit

サービスのチェック

proxysql.can_connect: Agent が ProxySQL に接続できない場合は CRITICAL を返します。それ以外の場合は OK を返します。このサービスチェックは serverport でタグ付けされます。

proxysql.backend.status: ProxySQL がバックエンドホストを SHUNNED または OFFLINE_HARD とみなす場合は CRITICAL を返します。バックエンドホストが OFFLINE_SOFT の場合は WARNING を返します。それ以外の場合は OK を返します。このサービスチェックはhostgroupsrv_hostsrv_port でタグ付けされます。

イベント

ProxySQL チェックにはイベントは含まれません。

トラブルシューティング

ご不明な点は、Datadog のサポートチームまでお問合せください。