找回密码
 注册
查看: 1896|回复: 1

Ceph监控 ceph集群添加监控

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-11-16 15:00:12 | 显示全部楼层 |阅读模式
1.命令行查看集群
监视Ceph集群是一项日常任务,包括监视MON、OSD、MDS、PG,以及存储供应服务,例如RBD、radosgw、Ceph FS和Ceph客户机。Ceph默认情况下提供了一组丰富的本地命令行工具和api来对这些组件执行监视。
  • 检查集群的健康状况
  • $ ceph health
  • $ ceph health detail
  • 查看集群事件
  • $ ceph -w # 集群的动态更改信息
  • $ ceph --watch-debug # debug
  • --watch-info: to watch info events
  • --watch-sec: to watch security events
  • --watch-warn: to watch warning events
  • --watch-error: to watch error events
  • 集群利用率统计
  • $ ceph df
  • GLOBAL:
  • SIZE AVAIL RAW USED %RAW USED
  • 180GiB 148GiB 31.9GiB 17.73
  • POOLS:
  • NAME ID USED %USED MAX AVAIL O
  • BJECTS
  • rbd 1 7.62GiB 15.15 42.7GiB 1971
  • .rgw.root 2 1.09KiB 0 42.7GiB 4
  • default.rgw.control 3 0B 0 42.7GiB 8
  • default.rgw.meta 4 0B 0 42.7GiB 0
  • default.rgw.log 5 0B 0 42.7GiB 207
  • cephfs_data 6 0B 0 42.7GiB 0
  • cephfs_metadata 7 2.19KiB 0 42.7GiB 21
  • ssd-pool 8 229B 0 15.2GiB 1
  • sata-pool 9 229B 0 15.3GiB 1
  • $ ceph df detail
  • 检查集群的状态
  • $ ceph status
  • $ ceph -s
  • 集群身份验证
  • $ ceph auth list
  • 检查 Mon 状态
  • $ ceph mon stat
  • $ ceph mon dump
  • $ ceph quorum_status -f json-pretty
  • OSD查看
  • $ ceph osd tree
  • $ ceph osd dump
  • Crush map的查看
  • $ ceph osd crush dump
  • $ ceph osd crush rule list
  • $ ceph osd crush rule dump
  • $ ceph osd find
  • PGs 的查看
  • $ ceph PG stat
  • $ ceph pg dump -f json-pretty
  • $ ceph pg query # 查询特定pg的详细信息
  • Ceph MDS 的查看
  • $ ceph PG stat
  • $ ceph pg dump -f json-pretty
  • $ ceph pg query # 查询特定pg的详细信息
    * E/ c9 H# S0 S' S
2.prometheus
官方参考地址:https://github.com/ceph/cephmetrics/ ]& L7 O$ c6 m' o) c8 q2 P
step 1. ceph集群启动 prometheus 模块
  • $ ceph mgr module enable prometheus
    + E( S: N3 W/ y5 \5 I) o3 S) ]# K
step 2. prometheus 安装
8 S8 Z% L7 e, M# B3 o官方下载:https://prometheus.io/download/; Y, C8 P; c' ?$ Y
1.prometheus 下载
  • wget https://github.com/prometheus/prometheus/releases/download/v2.9.2/prometheus-2.9.2.linux-amd64.tar.gz
  • tar -zxvf prometheus-2.9.2.linux-amd64.tar.gz
  • cd prometheus-2.9.2.linux-amd64
    / q) J# ]- O7 q
2.配置prometheus.yml
  • $vim prometheus.yml
  • ...
  • - job_name: 'ceph'
  •     honor_labels: true
  •     file_sd_configs:
  •         - files:
  •          - ceph_targets.yml. @+ Z; \) O( S" C6 C
3.编辑ceph_targets.yml
  • $ cat ceph_targets.yml
  • [
  •     {
  •         "targets": ["chao-1:9283","chao-2:9283","chao-3:9283"],"labels": {}
  •     }

  • , D$ Q; U& s( t) n
4.运行
  • $ nohup ./prometheus --config.file prometheus.yml >> /var/log/prometheus.
  • out 2>&1 &" d3 L5 p2 |: q" y1 }7 H
5.测试
7 o8 C( d6 c3 S, I9 k$ i浏览器打开: http://192.168.13.17:9090
step 3. grafana 安装
. L: A- ]+ f# P6 a! b, I官方下载:https://grafana.com/grafana/download  @$ @! ^9 @5 d+ J$ S2 w
1.软件下载
  • $ wget https://dl.grafana.com/oss/release/grafana-6.1.4-1.x86_64.rpm
  • $ sudo yum localinstall grafana-6.1.4-1.x86_64.rpm
  • 修改serverport 为需要的端口30000
    7 U6 o5 A# F1 O" ~. {# ]$ u
2.启动服务
  • $ systemctl enable grafana-server$ systemctl start grafana-server
    1 ^% G) s2 y0 w$ r# [9 _. W
3.设置数据源
+ B, T+ b1 [6 x  d3 s* ?; l1 M/ ^http://192.168.13.17:9090
4.导入模板
  • Ceph-Cluster [ID: 2842
  • Ceph-OSD: [ID: 5336
  • Ceph-Pools: [ID: 5342
    ; _$ w5 y3 r% t. Q) |

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-11-18 14:58:19 | 显示全部楼层
nohup /var/local/prometheus-2.29.0-rc.2.linux-amd64/prometheus --config.file  /var/local/prometheus-2.29.0-rc.2.linux-amd64/prometheus.yml &
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 02:05 , Processed in 0.027465 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表