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

启动Prometheus server
[root@ceph-mgr02 prometheus]# systemctl daemon-reload[root@ceph-mgr02 prometheus]# systemctl start prometheus[root@ceph-mgr02 prometheus]# systemctl status prometheus● 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 21:46:09 CST; 4s agoDocs: https://prometheus.io Main PID: 2258 (prometheus)CGroup: /system.slice/prometheus.service└─2258 /usr/local/prometheus/prometheus --storage.tsdb.path=/var/lib/prometheus --config.file=/usr/local/prometh...Oct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.691Z caller=head.go:536 level=info compo…6.545μsOct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.691Z caller=head.go:542 level=info compo...hile"Oct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.691Z caller=head.go:613 level=info compo...ent=0Oct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.691Z caller=head.go:619 level=info compo…6.765μsOct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.692Z caller=main.go:993 level=info fs_ty...MAGICOct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.692Z caller=main.go:996 level=info msg="...rted"Oct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.692Z caller=main.go:1177 level=info msg=...s.ymlOct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.693Z caller=main.go:1214 level=info msg="Comp…μsOct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.693Z caller=main.go:957 level=info msg="...sts."Oct 09 21:46:09 ceph-mgr02.ilinux.io prometheus[2258]: ts=2022-10-09T13:46:09.693Z 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[::]:*[root@ceph-mgr02 prometheus]#提示:Prometheus默认监听在tcp9090端口;使用systemd的方式启动Prometheus,如果没有报错,对应端口又处于监听状态说明Prometheus server就搭建好了;
部署node_exporter 收集ceph-mon01主机上的指标数据,以测试Prometheus 服务是否正常可用
[root@ceph-mon01 ~]# wget https://github.com/prometheus/node_exporter/releases/download/v1.4.0/node_exporter-1.4.0.linux-amd64.tar.gz创建运行node_exporter进程的系统用户,并为其创建家目录/var/lib/prometheus作为数据存储目录
[root@ceph-mon01 ~]# useradd -r -m -d /var/lib/prometheus prometheus[root@ceph-mon01 ~]# ll /var/lib/prometheus/ -ddrwx------ 2 prometheus prometheus 62 Oct9 21:51 /var/lib/prometheus/[root@ceph-mon01 ~]#解压压缩包并做软连接
[root@ceph-mon01 ~]# tar xf node_exporter-1.4.0.linux-amd64.tar.gz -C /usr/local/[root@ceph-mon01 ~]# cd /usr/local/[root@ceph-mon01 local]# lltotal 0drwxr-xr-x. 2 root root6 Apr 112018 bindrwxr-xr-x. 2 root root6 Apr 112018 etcdrwxr-xr-x. 2 root root6 Apr 112018 gamesdrwxr-xr-x. 2 root root6 Apr 112018 includedrwxr-xr-x. 2 root root6 Apr 112018 libdrwxr-xr-x. 2 root root6 Apr 112018 lib64drwxr-xr-x. 2 root root6 Apr 112018 libexecdrwxr-xr-x2 3434 3434 56 Sep 26 20:39 node_exporter-1.4.0.linux-amd64drwxr-xr-x. 2 root root6 Apr 112018 sbindrwxr-xr-x. 5 root root 49 Apr 112018 sharedrwxr-xr-x. 2 root root6 Apr 112018 src[root@ceph-mon01 local]# ln -s node_exporter-1.4.0.linux-amd64 node_exporter[root@ceph-mon01 local]# lltotal 0drwxr-xr-x. 2 root root6 Apr 112018 bindrwxr-xr-x. 2 root root6 Apr 112018 etcdrwxr-xr-x. 2 root root6 Apr 112018 gamesdrwxr-xr-x. 2 root root6 Apr 112018 includedrwxr-xr-x. 2 root root6 Apr 112018 libdrwxr-xr-x. 2 root root6 Apr 112018 lib64drwxr-xr-x. 2 root root6 Apr 112018 libexeclrwxrwxrwx1 root root 31 Oct9 21:52 node_exporter -> node_exporter-1.4.0.linux-amd64drwxr-xr-x2 3434 3434 56 Sep 26 20:39 node_exporter-1.4.0.linux-amd64drwxr-xr-x. 2 root root6 Apr 112018 sbindrwxr-xr-x. 5 root root 49 Apr 112018 sharedrwxr-xr-x. 2 root root6 Apr 112018 src[root@ceph-mon01 local]#

经验总结扩展阅读