#ceph-mgr1 部署
root@ceph-mgr1:~# apt-cache madison ceph-mgr-dashboard
root@ceph-mgr1:~# apt install -y ceph-mgr-dashboard
cephadmin@ceph-deploy:~$ ceph mgr module ls
cephadmin@ceph-deploy:~$ ceph mgr module enable dashboard #启用模块 注:模块启用后还不能直接访问,需要配置关闭SSL或启用 SSL及指定监听地址。
##启用dashboard模块
#第一次启用 dashboard 插件需要等一段时间(几分钟),再去被启用的节点验证。
#Ceph dashboard 在 mgr 节点进行开启设置,并且可以配置开启或者关闭 SSL,如下:
cephadmin@ceph-deploy:~$ ceph config set mgr mgr/dashboard/ssl false #关闭ssl
cephadmin@ceph-deploy:~$ ceph config set mgr mgr/dashboard/ceph-mgr1/server_addr 192.168.40.154 #配置监听地址
cephadmin@ceph-deploy:~$ ceph config set mgr mgr/dashboard/ceph-mgr1/server_port 9009 #配置监听端口
root@ceph-mgr1:~# systemctl restart ceph-mgr@ceph-mgr1.service
root@ceph-mgr1:~# lsof -i:9009
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ceph-mgr 832 ceph 21u IPv4 33924 0t0 TCP ceph-mgr1.sheca.com:9009 (LISTEN)
root@ceph-mgr1:~# ceph -s
cluster:
id: 0d8fb726-ee6d-4aaf-aeca-54c68e2584af
health: HEALTH_WARN
1 pool(s) do not have an application enabled
services:
mon: 3 daemons, quorum ceph-mon1,ceph-mon2,ceph-mon3 (age 5h)
mgr: ceph-mgr2(active, since 3m), standbys: ceph-mgr1
mds: 2/2 daemons up, 2 standby
osd: 9 osds: 9 up (since 5h), 9 in (since 6h)
rgw: 2 daemons active (2 hosts, 1 zones)
data:
volumes: 1/1 healthy
pools: 10 pools, 353 pgs
objects: 321 objects, 168 MiB
usage: 3.1 GiB used, 267 GiB / 270 GiB avail
pgs: 353 active+clean
##设置dashboard账户及密码
cephadmin@ceph-deploy:~$ touch passwd.txt
cephadmin@ceph-deploy:~$ echo "12345678" > passwd.txt
cephadmin@ceph-deploy:~$ ceph dashboard set-login-credentials admin -i passwd.txt
******************************************************************
*** WARNING: this command is deprecated. ***
*** Please use the ac-user-* related commands to manage users. ***
******************************
#登录界面
192.168.40.154:9009
admin/12345678
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Dashboard SSL
#如果要使用 SSL访问。则需要配置签名证书。证书可以使用 ceph 命令生成,或是 opessl命令生成。
#ceph自签名证书
root@ceph-mgr1:~# ceph dashboard create-self-signed-cert
Self-signed certificate created
root@ceph-mgr1:~# ceph config set mgr mgr/dashboard/ssl true
root@ceph-mgr1:~# ceph mgr services
{
"dashboard": "http://192.168.40.154:8443/"
}
Prometheus & node_exporter
##部署Prometheus和Node exporter
#ceph-mgr1
mkdir /apps
cd /apps/
tar zxvf prometheus-server-2.38.0-onekey-install.tar.gz
./prometheus-install.sh
#ceph-mon1、2、3
mkdir /apps
cd /apps/
tar zxvf node-exporter-1.3.1-onekey-install.tar.gz
bash node-exporter-1.3.1-onekey-install.sh
#配置conf
root@ceph-mgr1:/apps/prometheus# cat /apps/prometheus/prometheus.yml
- job_name: "Ceph Cluster Info"
static_configs:
- targets: ['192.168.40.151:9100','192.168.40.152:9100','192.168.40.153:9100']
root@ceph-mgr1:/apps/prometheus# systemctl restart prometheus
#
192.168.40.154:9090
##通过 prometheus 监控 ceph 服务:
#Ceph manager 内部的模块中包含了 prometheus 的监控模块,并监听在每个 manager 节点的 9283 端口
#该端口用于将采集到的信息通过 http 接口向 prometheus 提供数据
cephadmin@ceph-deploy:~$ ceph mgr module enable prometheus
root@ceph-mgr1:/apps/prometheus# ss -tnl | grep 9283
LISTEN 0 5 *:9283 *:*
root@ceph-mgr2:/var/log# ss -tnl | grep 9283
LISTEN 0 5 *:9283 *:*
#验证ceph-mgr1、2 数据
http://192.168.40.154:9283/
http://192.168.40.155:9283/
#修改Prometheus 配置文件
root@ceph-mgr1:/apps/prometheus# vim prometheus.yml
- job_name: "Ceph Cluster Data"
static_configs:
- targets: ['192.168.40.154:9283','192.168.40.155:9283']
![]()
![]()
![]()
![]()
Grafana
root@ceph-mgr1:/apps/prometheus# sudo apt-get install -y adduser libfontconfig1 musl
root@ceph-mgr1:/apps/prometheus# wget https://dl.grafana.com/enterprise/release/grafana-enterprise_10.4.0_amd64.deb
root@ceph-mgr1:/apps/prometheus# sudo dpkg -i grafana-enterprise_10.4.0_amd64.deb
root@ceph-mgr1:/apps/prometheus# systemctl enable grafana-server.service
Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
root@ceph-mgr1:/apps/prometheus# systemctl restart grafana-server.service
#admin/admin
192.168.40.154:3000
#添加数据源
#添加模板
5336 - ceph OSD
5342 - ceph pool
7056 - ceph cluster
2842 - ceph cluster
![]()
![]()
![]()
![]()