Haproxy¶
Haproxy のメトリクス情報を収集します。
インストールとデプロイ¶
バージョン要件¶
- HAProxy 2.0
- HAProxy Enterprise 2.0r1
- HAProxy ALOHA 11.5
1. Haproxy でメトリクスを有効化¶
Haproxy の設定ファイルを調整し、次のモジュール設定を追加します。
frontend prometheus
bind *:8405
mode http
http-request use-service prometheus-exporter if { path /metrics }
no log
......
prometheus-exporter を通じてメトリクス情報を公開し、ポートは 8405、path は /metrics です。
Haproxy サービスを再起動します。8405 ポートにアクセスしてメトリクス情報を取得します。以下のとおりです。
# HELP haproxy_process_nbthread Number of started threads (global.nbthread)
# TYPE haproxy_process_nbthread gauge
haproxy_process_nbthread 8
# HELP haproxy_process_nbproc Number of started worker processes (historical, always 1)
# TYPE haproxy_process_nbproc gauge
haproxy_process_nbproc 1
# HELP haproxy_process_relative_process_id Relative worker process number (1)
# TYPE haproxy_process_relative_process_id gauge
haproxy_process_relative_process_id 1
# HELP haproxy_process_uptime_seconds How long ago this worker process was started (seconds)
# TYPE haproxy_process_uptime_seconds gauge
haproxy_process_uptime_seconds 1364
...
2. DataKit 収集器の設定¶
2.1 DataKit をインストール¶
2.2 収集器を設定する¶
Haproxy は metrics URL を直接公開できるため、prom 収集器で直接収集できます。
DataKit のインストールディレクトリ の conf.d/samples に移動し、prom.conf.sample を haproxy.conf としてコピーします。
cp prom.conf.sample haproxy.conf
haproxy.conf の内容を次のように調整します。
その他の設定は必要に応じて調整してください
、調整パラメータの説明は次のとおりです。
- urls:
haproxyメトリクスのアドレス。ここには対応コンポーネントが公開するメトリクス URL を記入します - source:収集器の別名。区別できるようにすることを推奨します
- keep_exist_metric_name: メトリクス名を保持する
- interval:収集間隔
3. DataKit を再起動¶
メトリクス¶
haproxy メトリクスセット¶
| メトリクス | 説明 | 単位 |
|---|---|---|
backend_bytes_in_total |
バックエンドの総受信バイト数 | byte |
backend_bytes_out_total |
バックエンドの総送信バイト数 | byte |
backend_client_aborts_total |
バックエンドのクライアント切断総数 | count |
backend_connect_time_average_seconds |
バックエンドの平均接続時間(秒) | seconds |
backend_connection_attempts_total |
バックエンドの接続試行総数 | count |
backend_connection_errors_total |
バックエンドの接続エラー総数 | count |
backend_connection_reuses_total |
バックエンドの接続再利用総数 | count |
backend_current_queue |
バックエンドの現在のキュー | count |
backend_current_sessions |
バックエンドの現在のセッション数 | count |
backend_internal_errors_total |
バックエンドの内部エラー総数 | count |
backend_loadbalanced_total |
バックエンドのロードバランス総数 | count |
backend_max_queue |
バックエンドの最大キュー | count |
backend_max_sessions |
バックエンドの最大セッション数 | count |
backend_requests_denied_total |
バックエンドで拒否されたリクエスト総数 | count |
backend_response_errors_total |
バックエンドのレスポンスエラー総数 | count |
backend_responses_denied_total |
バックエンドで拒否されたレスポンス総数 | count |
backend_retry_warnings_total |
バックエンドの再試行警告総数 | count |
backend_server_aborts_total |
バックエンドのサーバー切断総数 | count |
backend_sessions_total |
バックエンドのセッション総数 | count |
frontend_bytes_in_total |
フロントエンドの総受信バイト数 | byte |
frontend_bytes_out_total |
フロントエンドの総送信バイト数 | byte |
frontend_connections_total |
フロントエンドの接続総数 | count |
frontend_current_sessions |
フロントエンドの現在のアクティブセッション数 | count |
frontend_denied_connections_total |
フロントエンドで拒否された接続総数 | count |
frontend_denied_sessions_total |
フロントエンドで拒否されたセッション総数 | count |
frontend_intercepted_requests_total |
フロントエンドで傍受されたリクエスト総数 | count |
frontend_internal_errors_total |
フロントエンドの内部エラー総数 | count |
frontend_limit_session_rate |
フロントエンドのセッションレート制限 | count |
frontend_limit_sessions |
フロントエンドのセッション数制限 | count |
frontend_max_sessions |
フロントエンドの最大セッション数 | count |
frontend_request_errors_total |
フロントエンドのリクエストエラー総数 | count |
frontend_requests_denied_total |
フロントエンドで拒否されたリクエスト総数 | count |
frontend_responses_denied_total |
フロントエンドで拒否されたレスポンス総数 | count |
frontend_sessions_total |
フロントエンドのセッション総数 | count |
server_bytes_in_total |
サーバーの総受信バイト数 | byte |
server_bytes_out_total |
サーバーの総送信バイト数 | byte |
server_response_errors_total |
サーバーのレスポンスエラー総数 | count |
server_response_time_average_seconds |
サーバーの平均レスポンス時間(秒) | seconds |
server_responses_denied_total |
サーバーで拒否されたレスポンス総数 | count |
server_retry_warnings_total |
サーバーの再試行警告総数 | count |
server_safe_idle_connections_current |
サーバーの現在の安全なアイドル接続数 | count |
server_server_aborts_total |
サーバーの切断総数 | count |
server_sessions_total |
サーバーのセッション総数 | count |
server_used_connections_current |
サーバーの現在使用中の接続数 | count |
server_uweight |
サーバーの非重み | count |
server_weight |
サーバーの重み | count |
その他のメトリクスの説明は、haproxy 公式ドキュメント を参照してください。