コンテンツにスキップ

FastDFS

FastDFS のメトリクスデータを収集

インストール設定

前提条件

  • DataKit をインストール済み
  • Python >= 3.10
  • Gunicorn = 23.0.0
  • Flask = 3.1.0
  • Prometheus_client = 0.21.1

fastdfs-exporter のダウンロード

  • fastdfs-exporter は公式が開発した専用 Exporter で、FastDFS の状態を Prometheus のメトリクス形式に変換します:
wget https://github.com/maxpasserby/fastdfs-exporter/archive/refs/tags/0.1.1.tar.gz
  • exporter ディレクトリを /etc ディレクトリへ移動し、以下のコマンドで exporter.main を実行します
python3 -u -m exporter.main
  • Exporter をバックグラウンドで実行するように設定します
nohup /usr/bin/python3.6 -u -m exporter.main &
  • 起動後は 127.0.0.1:9036/metrics でメトリクスにアクセスできます

DataKit 収集器の設定

FastDFS は JMX Exporter を通じて metrics URL を直接公開できるため、prom 収集器でそのまま収集できます。

DataKit のインストールディレクトリconf.d/samples に移動し、以下のコマンドを実行します。

cp prom.conf.sample prom-fastdfs.conf.conf

prom-fastdfs.conf の内容を調整し、主に urls を設定します。例:

[[inputs.prom]]
  ## Exporter URLs.
  urls = ["http://127.0.0.1:9036/metrics"]

  ## Stream Size. 
  ## The source stream segmentation size, (defaults to 1).
  ## 0 source stream undivided. 
  # stream_size = 1

  ## Unix Domain Socket URL. Using socket to request data when not empty.
  uds_path = ""

  ## Ignore URL request errors.
  ignore_req_err = false

  ## Collector alias.
  source = "fastdfs"

その他の設定は必要に応じて調整してください、パラメータの説明は次のとおりです:

  • urls:prometheus メトリクスのアドレス。ここには対応コンポーネントが公開するメトリクス URL を指定します
  • source:収集器の別名。識別できるように分けることを推奨します
  • interval:収集間隔

Datakit の再起動

Datakit service -R

メトリクス

指標 説明 単位
storage_join_time_seconds ストレージサーバーがクラスタに参加した時刻。この値が true のとき、名前空間はクライアントからの書き込み受付を停止します Int
storage_up_time_seconds ストレージサーバーの前回起動時刻(または最新の再起動時刻) Int
storage_total_space_bytes ストレージサーバーの総ディスク容量 Int
free_space_bytes ストレージサーバーの利用可能なディスク容量 Int
storage_connection_alloc_count 累積で割り当てられた接続数(起動以降) Int
storage_connection_current_count 現在使用中の接続数 Int
storage_connection_max_count 最大許容接続数 Int
storage_total_delete_count ファイルの総削除回数 Int
storage_success_download_count ファイルのダウンロード成功回数 Int
storage_total_modify_count ファイルの総変更回数 Int
group_storage_server_count storage group のストレージサーバー数 Int
group_active_storage_server_count storage group で稼働中のストレージサーバー数 Int
group_disk_total_space_bytes storage group の総ディスク容量 Int
group_disk_free_space_bytes storage group の残りディスク容量 Int

フィードバック

このページは役に立ちましたか?