2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Fluent Bit on GKE を Google Cloud Monitoring で監視する

Posted at

GKE上で動かしているFluent Bitのメトリクスを簡単にGoogle Cloud Monitoring で可視化する方法を紹介します。

前提

1. Fluent Bit の HTTP サーバーを有効化

Fluent Bit はビルトインの HTTP サーバーを持っており、Prometheus 形式でメトリクスを公開できます。

設定ファイルで HTTP サーバーを有効にします。

[SERVICE]
    Http_Server  On
    Http_Listen  0.0.0.0
    Http_Port    2020

これにより、Fluent Bit が /api/v2/metrics/prometheus エンドポイントで Prometheus 形式のメトリクスを公開します。

なお、/api/v1/metrics/prometheus もありますが、v2 の方が Filter メトリクスやレイテンシ histogram など取得できる情報が多いため、v2 を使うのがおすすめです。

参考: Fluent Bit - Monitoring

2. PodMonitoring リソースを作成

GKE の PodMonitoring リソースを作成して、Fluent Bit のメトリクスを Cloud Monitoring に収集します。

apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
  name: fluentbit-monitoring
  namespace: default
spec:
  selector:
    matchLabels:
      app: your-fluentbit-app  # Fluent Bit の Pod に付与しているラベルに合わせる
  endpoints:
  - port: 2020
    interval: 30s
    path: /api/v2/metrics/prometheus
kubectl apply -f fluentbit-pod-monitoring.yaml

参考: Get started with managed collection

3. Cloud Monitoring で確認

Google Cloud Console の Metrics Explorer を開き、fluentbit で検索するとメトリクスが表示されます。

主なメトリクス:

メトリクス 説明
fluentbit_input_bytes_total Input プラグインが受信した総バイト数
fluentbit_input_records_total Input プラグインが受信した総レコード数
fluentbit_output_proc_bytes_total Output プラグインが処理した総バイト数
fluentbit_output_proc_records_total Output プラグインが処理した総レコード数
fluentbit_output_errors_total Output プラグインのエラー数
fluentbit_output_retries_total Output プラグインのリトライ数

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?