- 重要な情報
- はじめに
- 用語集
- ガイド
- エージェント
- インテグレーション
- OpenTelemetry
- 開発者
- API
- CoScreen
- アプリ内
- Service Management
- インフラストラクチャー
- アプリケーションパフォーマンス
- 継続的インテグレーション
- ログ管理
- セキュリティ
- UX モニタリング
- 管理
Supported OS
PgBouncer チェックは、接続プールメトリクスを追跡し、アプリケーションに出入りするトラフィックの監視を可能にします。
PgBouncer チェックは Datadog Agent パッケージに含まれています。PgBouncer ノードに追加でインストールする必要はありません。
このチェックには、PgBouncer インスタンスを照会するための関連ユーザーが必要です。
PgBouncer の pgbouncer.ini
ファイルに Datadog ユーザーを作成します。
stats_users = datadog
PgBouncer の userlist.txt
ファイルに datadog
ユーザーの関連パスワードを追加します。
"datadog" "<PASSWORD>"
認証情報を確認するには、次のコマンドを実行します。
psql -h localhost -U datadog -p 6432 pgbouncer -c \
"SHOW VERSION;" \
&& echo -e "\e[0;32mpgBouncer connection - OK\e[0m" \
|| echo -e "\e[0;31mCannot connect to pgBouncer\e[0m"
パスワードの入力を要求されたら、userlist.txt
に追加したパスワードを入力します。
ホストで実行中の Agent に対してこのチェックを構成するには:
Agent のコンフィギュレーションディレクトリ
のルートにある conf.d/
フォルダーの pgbouncer.d/conf.yaml
ファイルを編集します。使用可能なすべてのコンフィギュレーションオプションの詳細については、サンプル pgbouncer.d/conf.yaml
を参照してください。
init_config:
instances:
## @param database_url - string - required
## `database_url` parameter should point to PgBouncer stats database url (ie. "pgbouncer")
#
- database_url: "postgresql://datadog:<PASSWORD>@<HOSTNAME>:<PORT>/<DATABASE_URL>?sslmode=require"
注: PgBouncer のインスタンスに SSL サポートがない場合は、sslmode=require
を sslmode=allow
と置換してサーバーエラーを防ぎます。詳細は、SSL サポート
の Postgres ドキュメントを参照してください。
Agent バージョン 6.0 以降で利用可能
Datadog Agent で、ログの収集はデフォルトで無効になっています。以下のように、datadog.yaml
ファイルでこれを有効にします。
logs_enabled: true
Pgbouncer のログの収集を開始するには、次の構成ブロックを pgbouncer.d/conf.yaml
ファイルに追加します。
logs:
- type: file
path: /var/log/postgresql/pgbouncer.log
source: pgbouncer
service: "<SERVICE_NAME>"
path
パラメーターと service
パラメーターの値を変更し、環境に合わせて構成してください。使用可能なすべてのコンフィギュレーションオプションの詳細については、サンプル pgbouncer.d/conf.yaml
を参照してください。
コンテナ環境の場合は、オートディスカバリーのインテグレーションテンプレート のガイドを参照して、次のパラメーターを適用してください。
パラメーター | 値 |
---|---|
<インテグレーション名> | pgbouncer |
<初期コンフィギュレーション> | 空白または {} |
<インスタンスコンフィギュレーション> | {"database_url": "postgresql://datadog:<パスワード>@%%host%%:%%port%%/<データベース_URL>?sslmode=require"} |
Agent バージョン 6.0 以降で利用可能
Datadog Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、Kubernetes ログ収集 を参照してください。
パラメーター | 値 |
---|---|
<LOG_CONFIG> | {“source”: “pgbouncer”, “service”: “pgbouncer”} |
Agent の status サブコマンドを実行
し、Checks セクションで pgbouncer
を探します。
pgbouncer.max_client_conn (gauge) | The maximum number of client connections allowed. Shown as connection |
pgbouncer.stats.requests_per_second (rate) | The request rate Shown as request |
pgbouncer.stats.queries_per_second (rate) | The query rate Shown as query |
pgbouncer.stats.transactions_per_second (rate) | The transaction rate Shown as transaction |
pgbouncer.stats.bytes_received_per_second (rate) | The total network traffic received Shown as byte |
pgbouncer.stats.bytes_sent_per_second (rate) | The total network traffic sent Shown as byte |
pgbouncer.stats.total_query_time (rate) | Time spent by pgbouncer actively querying PostgreSQL Shown as microsecond |
pgbouncer.stats.total_transaction_time (rate) | Time spent by pgbouncer in transactions Shown as microsecond |
pgbouncer.stats.avg_req (gauge) | The average number of requests per second in last stat period Shown as request |
pgbouncer.stats.avg_query_count (gauge) | The average number of queries per second in last stat period Shown as query |
pgbouncer.stats.total_wait_time (gauge) | Time spent by clients waiting for a server, in microseconds Shown as microsecond |
pgbouncer.stats.avg_wait_time (gauge) | Time spent by clients waiting for a server, in microseconds (average per second) Shown as microsecond |
pgbouncer.stats.avg_transaction_count (gauge) | The average number of transactions per second in last stat period Shown as transaction |
pgbouncer.stats.avg_recv (gauge) | The client network traffic received Shown as byte |
pgbouncer.stats.avg_sent (gauge) | The client network traffic sent Shown as byte |
pgbouncer.stats.avg_query (gauge) | The average query duration Shown as microsecond |
pgbouncer.stats.avg_query_time (gauge) | The average query duration Shown as microsecond |
pgbouncer.stats.avg_transaction_time (gauge) | The average transaction duration Shown as microsecond |
pgbouncer.pools.cl_active (gauge) | Client connections linked to server connection and able to process queries Shown as connection |
pgbouncer.pools.cl_waiting (gauge) | Client connections waiting on a server connection Shown as connection |
pgbouncer.pools.sv_active (gauge) | Server connections linked to a client connection Shown as connection |
pgbouncer.pools.sv_idle (gauge) | Server connections idle and ready for a client query Shown as connection |
pgbouncer.pools.sv_used (gauge) | Server connections idle more than servercheckdelay, needing servercheckquery Shown as connection |
pgbouncer.pools.sv_tested (gauge) | Server connections currently running either serverresetquery or servercheckquery Shown as connection |
pgbouncer.pools.sv_login (gauge) | Server connections currently in the process of logging in Shown as connection |
pgbouncer.pools.maxwait (gauge) | How long the first (oldest) client in the queue has waited, in seconds Shown as second |
pgbouncer.pools.maxwait_us (gauge) | Microsecond part of the maximum waiting time Shown as microsecond |
pgbouncer.databases.pool_size (gauge) | Maximum number of server connections Shown as connection |
pgbouncer.databases.max_connections (gauge) | Maximum number of allowed connections Shown as connection |
pgbouncer.databases.current_connections (gauge) | Current number of connections for this database Shown as connection |
pgbouncer.clients.connect_time (gauge) | When the connection was made (seconds since epoch) Shown as second |
pgbouncer.clients.request_time (gauge) | When last request was issued (seconds since epoch) Shown as second |
pgbouncer.clients.wait (gauge) | Current waiting time in seconds Shown as second |
pgbouncer.clients.wait_us (gauge) | The microsecond portion of the current waiting time Shown as microsecond |
pgbouncer.servers.connect_time (gauge) | When the connection was made (seconds since epoch) Shown as second |
pgbouncer.servers.request_time (gauge) | When last request was issued (seconds since epoch) Shown as second |
注: PgBouncer のバージョンによっては、すべてのメトリクスを使用できないことがあります。
PgBouncer チェックには、イベントは含まれません。
pgbouncer.can_connect
Agent が監視対象の PGBouncer インスタンスに接続できない場合は、CRITICAL
を返します。それ以外の場合は、OK
を返します。
Statuses: ok, クリティカル
ご不明な点は、Datadog のサポートチーム までお問合せください。