分布式存储系统之Ceph集群启用Dashboard及使用Prometheus监控Ceph( 七 )

访问Prometheus server所在主机的9090端口

分布式存储系统之Ceph集群启用Dashboard及使用Prometheus监控Ceph

文章插图
提示:可以看到访问Prometheus 所在主机的9090端口,对应能够查到node_exporter采集到数据;说明Prometheus server和node_exporter是部署是没有问题;
Ceph mgr启用Prometheus模块
Ceph Manager内置了众多模块,包括prometheus模块,用于直接输出Prometheus?格的指标数据 。
分布式存储系统之Ceph集群启用Dashboard及使用Prometheus监控Ceph

文章插图
提示:Prometheus模块默认监听于TCP协议的9283端口;这里需要说明一下,ceph只要启用了Prometheus模块以后,只要运行的有mgr的节点,对应都会监听9283端口;
验证:查看mgr运行主机是否监听9283端口?对应端口是否可访问?
[root@ceph-admin ~]# ceph mgr services{"dashboard": "https://0.0.0.0:8443/","prometheus": "http://ceph-mgr01.ilinux.io:9283/"}[root@ceph-admin ~]# ssh ceph-mgr01 'ss -tnl'StateRecv-Q Send-Q Local Address:PortPeer Address:PortLISTEN05*:8443*:*LISTEN0128172.16.30.74:6800*:*LISTEN0128192.168.0.74:6800*:*LISTEN0128192.168.0.74:6801*:*LISTEN0128172.16.30.74:6801*:*LISTEN0128172.16.30.74:6802*:*LISTEN0128192.168.0.74:6802*:*LISTEN0128192.168.0.74:6803*:*LISTEN0128172.16.30.74:6803*:*LISTEN0128192.168.0.74:6804*:*LISTEN0128*:22*:*LISTEN0100127.0.0.1:25*:*LISTEN05[::]:9283[::]:*LISTEN0128[::]:22[::]:*LISTEN0100[::1]:25[::]:*[root@ceph-admin ~]# curl http://ceph-mgr01.ilinux.io:9283/<!DOCTYPE html><html><head><title>Ceph Exporter</title></head><body><h1>Ceph Exporter</h1><p><a href='https://www.huyubaike.com/metrics'>Metrics</a></p></body></html>[root@ceph-admin ~]#
分布式存储系统之Ceph集群启用Dashboard及使用Prometheus监控Ceph

文章插图
提示:可以看到对应ceph-mgr01的9283是处于监听状体,并且也是可以正常访问的;
将ceph exporter纳入Prometheus server中去
分布式存储系统之Ceph集群启用Dashboard及使用Prometheus监控Ceph

文章插图
重启Prometheus server
[root@ceph-mgr02 prometheus]# systemctl restart prometheus.service[root@ceph-mgr02 prometheus]# systemctl status prometheus.service● prometheus.service - The Prometheus 2 monitoring system and time series database.Loaded: loaded (/usr/lib/systemd/system/prometheus.service; disabled; vendor preset: disabled)Active: active (running) since Sun 2022-10-09 22:37:16 CST; 5s agoDocs: https://prometheus.io Main PID: 2481 (prometheus)CGroup: /system.slice/prometheus.service└─2481 /usr/local/prometheus/prometheus --storage.tsdb.path=/var/lib/prometheus --config.file=/usr/local/prometh...Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.347Z caller=head.go:613 level=info compo...ent=2Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.387Z caller=head.go:613 level=info compo...ent=2Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.393Z caller=head.go:613 level=info compo...ent=2Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.393Z caller=head.go:619 level=info compo…77763msOct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.394Z caller=main.go:993 level=info fs_ty...MAGICOct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.394Z caller=main.go:996 level=info msg="...rted"Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.394Z caller=main.go:1177 level=info msg=...s.ymlOct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.395Z caller=main.go:1214 level=info msg="Comp…μsOct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.395Z caller=main.go:957 level=info msg="...sts."Oct 09 22:37:16 ceph-mgr02.ilinux.io prometheus[2481]: ts=2022-10-09T14:37:16.395Z caller=manager.go:941 level=info co...r..."Hint: Some lines were ellipsized, use -l to show in full.[root@ceph-mgr02 prometheus]# ss -tnlStateRecv-Q Send-QLocal Address:PortPeer Address:PortLISTEN0128172.16.30.75:6800*:*LISTEN0128192.168.0.75:6800*:*LISTEN0128172.16.30.75:6801*:*LISTEN0128192.168.0.75:6801*:*LISTEN0128192.168.0.75:6802*:*LISTEN0128172.16.30.75:6802*:*LISTEN0128192.168.0.75:6803*:*LISTEN0128172.16.30.75:6803*:*LISTEN0128*:22*:*LISTEN0100127.0.0.1:25*:*LISTEN05*:8443*:*LISTEN0128[::]:22[::]:*LISTEN0100[::1]:25[::]:*LISTEN0128[::]:9090[::]:*LISTEN05[::]:9283[::]:*[root@ceph-mgr02 prometheus]#

经验总结扩展阅读