跳转至

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

文档评价

文档内容是否对您有帮助? ×