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


[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]#创建Unit File
[root@ceph-mon01 local]# cat /usr/lib/systemd/system/node_exporter.service[Unit]Description=Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.Documentation=https://github.com/prometheus/node_exporterAfter=network.target[Service]EnvironmentFile=-/etc/sysconfig/node_exporterUser=prometheusExecStart=/usr/local/node_exporter/node_exporter \$NODE_EXPORTER_OPTSRestart=on-failureStartLimitInterval=1RestartSec=3[Install]WantedBy=multi-user.target[root@ceph-mon01 local]#启动node_exporter
[root@ceph-mon01 local]# systemctl daemon-reload[root@ceph-mon01 local]# systemctl start node_exporter[root@ceph-mon01 local]# systemctl status node_exporter.service● node_exporter.service - Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; disabled; vendor preset: disabled)Active: active (running) since Sun 2022-10-09 21:58:12 CST; 6s agoDocs: https://github.com/prometheus/node_exporter Main PID: 3247 (node_exporter)CGroup: /system.slice/node_exporter.service└─3247 /usr/local/node_exporter/node_exporterOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...zoneOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...timeOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...imexOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...euesOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...nameOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...statOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...=xfsOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:115 level...=zfsOct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=node_exporter.go:199 level...9100Oct 09 21:58:12 ceph-mon01.ilinux.io node_exporter[3247]: ts=2022-10-09T13:58:12.121Z caller=tls_config.go:195 level=in...alseHint: Some lines were ellipsized, use -l to show in full.[root@ceph-mon01 local]# ss -tnlStateRecv-Q Send-QLocal Address:PortPeer Address:PortLISTEN0128172.16.30.71:6803*:*LISTEN0128192.168.0.71:6803*:*LISTEN0128192.168.0.71:6804*:*LISTEN0128*:22*:*LISTEN0128*:7480*:*LISTEN0100127.0.0.1:25*:*LISTEN05*:8443*:*LISTEN0128192.168.0.71:6789*:*LISTEN0128172.16.30.71:6800*:*LISTEN0128192.168.0.71:6800*:*LISTEN0128172.16.30.71:6801*:*LISTEN0128192.168.0.71:6801*:*LISTEN0128172.16.30.71:6802*:*LISTEN0128192.168.0.71:6802*:*LISTEN0128[::]:22[::]:*LISTEN0100[::1]:25[::]:*LISTEN0128[::]:9100[::]:*[root@ceph-mon01 local]#提示:node_exporter默认监听在tcp的9100,通过这个端口加/metrics可以输出对应采集到的指标数据;
验证,访问ceph-mon01的9100 , 看看对应指标数据是否采集到了?

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

文章插图
提示:可以看到访问192.168.0.71:9100/metrics能够输出很多指标数据,说明node_exproter部署没有问题;
将node_exporter的指标数据导入Prometheus server

推荐阅读