在Ceph Luminous以前的版本,能够使用第三方的Prometheus exporterceph_exporter。 Ceph Luminous 12.2.1的mgr中自带了Prometheus插件,内置了 Prometheus ceph exporter,能够使用Ceph mgr内置的exporter做为Prometheus的target。node
shell> ceph -v
ceph version 14.2.4 nautilus (stable) shell
① grafana部署
shell> yum -y install grafana
shell> rpm -qa | grep grafana
grafana-6.3.6-1.x86_64
shell> netstat -tunlp | grep grafana #监听3000端口
http://10.10.204.38:3000 默认密码admin adminvim
② prometheus server 部署
查看该连接部署https://blog.51cto.com/7603402/2444837浏览器
①找到mgr active 主机
shell> ceph -s
mgr: admin(active, since 107m), standbys: node140服务器
② 在ceph mgr admin节点上启动插件
shell>ceph mgr module enable prometheuscurl
③查看插件是否启动
shell>netstat -nltp | grep mgr
tcp6 0 0 :::9283 :::* LISTEN 59954/ceph-mgrtcp
④检查是否已经获取到数据
shell> curl 127.0.0.1:9283/metrics #能够看到大量的返回值 ide
shell>vim prometheus.yml
#在scrape_configs: 配置项下添加,注意空格按yml 2 4 6 8 空格的规则url
- job_name: 'ceph_cluster' honor_labels: true scrape_interval: 5s static_configs: - targets: ['10.10.202.142:9283'] labels: instance: ceph
① 重启prometheus 服务
shell>systemctl restart prometheus 插件
② 检查prometheus服务器中是否添加成功
浏览器-》 http://x.x.x.x:9090 -》status -》Targets
①浏览器登陆 grafana 管理界面
②添加data sources ,点击configuration--》data sources
③ 添加dashboard
点击HOME--》find dashboard on grafana.com
④ 搜索ceph的dashboard
⑤ 选择合适的dashboard,记录编号
⑥ Import dashboard 再选导入模板,输入编号
⑦ 漂亮的dashboard便可展示出来了: