Prometheus 監控 Ceph 集羣

Prometheus 監控 Ceph 集羣

Prometheus Module — Ceph Documentation

Prometheus 模塊啓用:

[root@node1 ~]# ceph mgr module enable prometheus

[root@node1 ~]# ceph mgr services
{
    "dashboard": "https://node1:8443/",
    "prometheus": "http://node1:9283/"
}
[root@node1 ~]# netstat -tnlp | grep 9283
tcp6       0      0 :::9283                 :::*                    LISTEN      1507703/ceph-mgr

默認情況下,模塊將在主機上的所有 IPv4 和 IPv6 地址的端口上接受 HTTP 請求。

ceph config set mgr mgr/prometheus/server_addr 0.0.0.0
ceph config set mgr mgr/prometheus/server_port 9283

Prometheus 監控 Ceph 集羣

安裝 prometheus 步驟請移步我之前的博客

掌握Prometheus 監控思科交換機技能,這篇文章就夠了!-餘生還長,何必慌張-51CTO博客

(一) Prometheus 監控思科交換機---各中間件安裝部署

ceph 各節點部署 node_exporter 程序包做監控

下載

wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz

解壓安裝:

tar -xf node_exporter-0.17.0.linux-amd64.tar.gz -C /usr/local/
cd /usr/local/
ln -sv node_exporter-0.17.0.linux-amd64/ node_exporter

Unit文件:/usr/lib/systemd/system/node_exporter.service

[Unit]
After=network.target

[Service]
EnvironmentFile=-/etc/sysconfig/node_exporter
User=ceph
ExecStart=/usr/local/node_exporter/node_exporter \
  $NODE_EXPORTER_OPTS
Restart=on-failure
StartLimitInterval=1
RestartSec=3

[Install]
WantedBy=multi-user.target

啓動node_exporter:

systemctl daemon-reload
systemctl start node_exporter.service

默認監聽9100端口:

curl localhost:9100/metrics

Prometheus.yml 添加如下內容

  - job_name: 'ceph-node'
    static_configs:
      - targets: ["192.168.6.160:9100","192.168.6.161:9100","192.168.6.162:9100"]
        labels:
          cluster: ceph-cluster

  - job_name: 'ceph-cluster'
    honor_labels: true
    static_configs:
      - targets: ['192.168.6.160:9283']
        labels:
          cluster: ceph-cluster

重啓 prometheus

systemctl restart prometheus

Prometheus 展示

Prometheus 監控 Ceph 集羣

接入 Grafana 展示

默認 mgr dashboard 就已經安裝 grafana 的 json文件,導入至 grafana 內即可

[root@node1 ~]# rpm -ql ceph-grafana-dashboards
/etc/grafana/dashboards/ceph-dashboard
/etc/grafana/dashboards/ceph-dashboard/ceph-cluster.json
/etc/grafana/dashboards/ceph-dashboard/cephfs-overview.json
/etc/grafana/dashboards/ceph-dashboard/host-details.json
/etc/grafana/dashboards/ceph-dashboard/hosts-overview.json
/etc/grafana/dashboards/ceph-dashboard/osd-device-details.json
/etc/grafana/dashboards/ceph-dashboard/osds-overview.json
/etc/grafana/dashboards/ceph-dashboard/pool-detail.json
/etc/grafana/dashboards/ceph-dashboard/pool-overview.json
/etc/grafana/dashboards/ceph-dashboard/radosgw-detail.json
/etc/grafana/dashboards/ceph-dashboard/radosgw-overview.json
/etc/grafana/dashboards/ceph-dashboard/rbd-details.json
/etc/grafana/dashboards/ceph-dashboard/rbd-overview.json
/usr/share/doc/ceph-grafana-dashboards-14.2.16
/usr/share/doc/ceph-grafana-dashboards-14.2.16/README
/usr/share/doc/ceph-grafana-dashboards-14.2.16/README.md

# grafana 官方 Dashboard 展示示例
https://grafana.com/grafana/dashboards/2842

Prometheus 監控 Ceph 集羣

Prometheus 監控 Ceph 集羣

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章