Ceph Dashboard Promethus+Grafana监控

matthewhan 2020-06-08

Ceph Dashboard介绍

Ceph 的监控可视化界面方案很多----grafana、Kraken。但是从Luminous开始,Ceph 提供了原生的Dashboard功能,通过Dashboard可以获取Ceph集群的各种基本状态信息。 mimic版 (nautilus版) dashboard 安装。如果是 (nautilus版) 需要安装 ceph-mgr-dashboard

配置Ceph Dashboard

1、在每个mgr节点安装
# yum install ceph-mgr-dashboard 
2、开启mgr功能
# ceph mgr module enable dashboard
3、生成并安装自签名的证书
# ceph dashboard create-self-signed-cert  
4、创建一个dashboard登录用户名密码
# ceph dashboard set-login-credentials admin admin 
5、查看服务访问方式
# ceph mgr services

Ceph Dashboard Promethus+Grafana监控

修改默认配置命令
指定集群dashboard的访问端口
# ceph config-key set mgr/dashboard/server_port 7000
指定集群 dashboard的访问IP
# ceph config-key set mgr/dashboard/server_addr $IP
开启Object Gateway管理功能
1、创建rgw用户
# radosgw-admin user create --uid=user01 --display-name=user01 --system
2、提供Dashboard证书
# ceph dashboard set-rgw-api-access-key $access_key
# ceph dashboard set-rgw-api-secret-key $secret_key
3、配置rgw主机名和端口
# ceph dashboard set-rgw-api-host 192.168.0.246
# ceph dashboard set-rgw-api-port 7480
4、刷新web页面

安装grafana

1、配置yum源文件
# vim /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

2.通过yum命令安装grafana
# yum -y install grafana

3.启动grafana并设为开机自启
# systemctl start grafana-server.service 
# systemctl enable grafana-server.service

安装promethus

1、下载安装包,下载地址
https://prometheus.io/download/
2、解压压缩包
# tar fvxz prometheus-2.14.0.linux-amd64.tar.gz
3、将解压后的目录改名
# mv prometheus-2.14.0.linux-amd64 /opt/prometheus
4、查看promethus版本
# /opt/prometheus/prometheus --version
5、配置系统服务启动
# vim /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System

[Service]
ExecStart=/opt/prometheus/prometheus   --config.file /opt/prometheus/prometheus.yml   --web.listen-address=:9090

[Install]
WantedBy=multi-user.target
6、加载系统服务
# systemctl daemon-reload
7、启动服务和添加开机自启动
# systemctl start prometheus
# systemctl enable prometheus

ceph mgr prometheus插件配置

# ceph mgr module enable prometheus
# netstat -nltp | grep mgr 检查端口
# curl 127.0.0.1:9283/metrics  测试返回值

配置promethus

在 scrape_configs: 配置项下添加
vim /opt/prometheus/prometheus.yml
- job_name: ‘ceph_cluster‘
    honor_labels: true
    scrape_interval: 5s
    static_configs:
      - targets: [‘192.168.0.246:9283‘]
        labels:
          instance: ceph

重启promethus服务
# systemctl restart prometheus

检查prometheus服务器中是否添加成功

Ceph Dashboard Promethus+Grafana监控

配置grafana
1、浏览器登录 grafana 管理界面  
2、添加data sources,点击configuration--》data sources  
3、添加dashboard,点击HOME--》find dashboard on grafana.com  
4、搜索ceph的dashboard    
5、点击HOME--》Import dashboard, 选择合适的dashboard,记录编号
Ceph Dashboard Promethus+Grafana监控
 

相关推荐