CEPH仪表板

Ceph仪表板是基于Web的内置Ceph管理和监视应用程序,用于管理集群的各个方面和对象。它作为Ceph Manager守护程序模块实现。

启用 dashboard

在正在运行的Ceph集群中,可以通过以下方式启用Ceph仪表板:

[ceph@ceph03 ~]$ ceph mgr module enable dashboard
Error ENOENT: all mgr daemons do not support module 'dashboard', pass --force to force enablement

#上面报错,是因为没有在mgr节点上安装ceph-mgr-dashboard,解决:
[ceph@ceph03 ~]$ sudo yum install ceph-mgr-dashboard -y

#安装完成后在集群的deploy节点上修改ceph.conf文件,添加内容如下:
[mon]
mgr initial modules = dashboard balancer

#推送到各节点下:
[ceph@ceph01 ceph-cluster]$ ceph-deploy --overwrite-conf config push ceph01 ceph02 ceph03 ceph04 ceph05 ceph06

#重启mgr
[ceph@ceph03 ~]$ sudo systemctl restart ceph-mgr@ceph03

#再次启用dashboard模块
[ceph@ceph03 ~]$ ceph mgr module enable dashboard

#查看模块是否被启用
[ceph@ceph03 ~]$ ceph mgr module ls|grep -A 5 enabled_modules
    "enabled_modules": [
        "dashboard",                     #这里可以看到模块已被启用
        "iostat",
        "pg_autoscaler",
        "restful"
    ],
配置dashboard web登录
SSL / TLS支持

默认情况下,与仪表板的所有HTTP连接均使用SSL/TLS保护。为了使仪表板快速启动并运行,您可以使用以下内置命令生成并安装自签名证书:

[ceph@ceph03 ~]$ ceph dashboard create-self-signed-cert

#查看ceph-mgr服务:
[ceph@ceph03 ~]$ ceph mgr services
{
    "dashboard": "https://ceph03:8443/"
}

#创建具有管理员角色的用户,语法:
ceph dashboard ac-user-create <username> <password> administrator
#实例:
[ceph@ceph03 ~]$ ceph dashboard ac-user-create admin admin administrator

#防火墙开放8443端口
[ceph@ceph03 ~]$ sudo firewall-cmd --permanent --add-port=8443/tcp
[ceph@ceph03 ~]$ sudo firewall-cmd --reload

#完成这些步骤就可以通过浏览器登录dashboard,注意上面地址没有域名映射的请通过ip地址访问

大多数Web浏览器都会对此类自签名证书进行告警的,为了正确部署并消除证书警告,应使用由证书颁发机构(CA)颁发的证书。可以通过运行以下命令为所有Ceph管理器实例启用它:

$ ceph dashboard set-ssl-certificate -i dashboard.crt         #dashboard.crt 替换为实际的证书
$ ceph dashboard set-ssl-certificate-key -i dashboard.key     #dashboard.key 替换为实际的私钥

如果出于某种原因要求每个管理器实例使用不同的证书,则可以按如下方式包括实例名称(其中$name,ceph-mgr实例名称,通常是主机名):

$ ceph dashboard set-ssl-certificate $name -i dashboard.crt
$ ceph dashboard set-ssl-certificate-key $name -i dashboard.key

当然也可以通过设置以下配置值来禁用SSL:

$ ceph config set mgr mgr/dashboard/ssl false

注意 更改SSL证书和密钥后,您需要手动重新启动Ceph管理器进程。这可以通过运行或禁用并重新启用仪表板模块来完成(这也会触发管理器重新生成自身):ceph mgr fail mgr

$ ceph mgr module disable dashboard
$ ceph mgr module enable dashboard
主机名和端口

可以通过群集范围内的配置密钥工具更改主机名和端口这些默认值(因此它们适用于所有管理器实例),如下所示:

$ ceph config set mgr mgr/dashboard/server_addr $IP
$ ceph config set mgr mgr/dashboard/server_port $PORT
$ ceph config set mgr mgr/dashboard/ssl_server_port $PORT
启用对象网关管理前端

如果您没有用于提供这些凭据的用户,则还需要创建一个:

$ radosgw-admin user create --uid=<user_id> --display-name=<display_name> \
    --system

记下这些键access_key以及secret_key,忘记的也可以通过radosgw-admin user info --uid=<user_id> 获取

向仪表板提供凭据:

$ ceph dashboard set-rgw-api-access-key <access_key>
$ ceph dashboard set-rgw-api-secret-key <secret_key>

如果在对象网关设置中使用自签名证书,则应在仪表板中禁用证书验证,以避免连接被拒绝,例如,由未知CA签名的证书或与主机名不匹配引起的连接被拒绝:

$ ceph dashboard set-rgw-api-ssl-verify False

如果对象网关处理请求的时间太长,并且仪表板发生超时,则可以根据需要设置超时值:

$ ceph dashboard set-rest-requests-timeout <seconds>         #默认值为45秒
启用ISCSI管理

如果ceph-iscsi REST API是在HTTPS模式下配置的,并且使用自签名证书,那么您需要配置仪表板,以避免在访问ceph-iscsi API时进行SSL证书验证。

如果ceph-iscsi REST API是在HTTPS模式下配置的,并且使用自签名证书,那么您需要配置仪表板,以避免在访问ceph-iscsi API时进行SSL证书验证。

必须使用以下命令定义可用的iSCSI网关:

$ ceph dashboard iscsi-gateway-list
$ ceph dashboard iscsi-gateway-add <scheme>://<username>:<password>@<host>[:port]
$ ceph dashboard iscsi-gateway-rm <gateway_name>

启用GRAFANA仪表板的嵌入

Grafana需要Prometheus的数据。在主机上安装Prometheus和Grafana之后,请继续以下步骤:

1、通过运行以下命令启用作为Ceph Manager模块附带的Ceph Exporter:

$ ceph mgr module enable prometheus

2、将相应的抓取配置添加到Prometheus,例如:

global:
  scrape_interval: 5s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'ceph'
    static_configs:
      - targets: ['192.168.37.7:9283']             #替换成你的ceph mgr的主机地址

3、将Prometheus作为数据源添加到Grafana
4、启用动态OSD性能计数器,该模块可以选择收集RBD每映像IO统计信息。参数是逗号或空格分隔的pool[/namespace]条目列表。如果未指定名称空间,则将收集池中所有名称空间的统计信息。例,激活启用之前创建的images RBD池。

[ceph@ceph03 ~]$ ceph config set mgr mgr/prometheus/rbd_stats_pools "images"

5、使用以下命令安装grafana插件

grafana-cli plugins install vonage-status-panel
grafana-cli plugins install grafana-piechart-panel
service grafana-server restart                         #安装插件后重启grafana

6、导入仪表板json将仪表板添加到Grafana,->模板地址<-
7、在/etc/grafana/grafana.ini中配置Grafana 以适应匿名模式:

[auth.anonymous]
enabled = true
org_name = Main Org.
org_role = Viewer

[security]
allow_embedding = true

8、需要告诉仪表板哪个URL Grafana实例正在运行/部署:

ceph dashboard set-grafana-api-url <grafana-server-url>

9、如果在Grafana设置中使用自签名证书,则应在仪表板中禁用证书验证,以避免连接被拒绝

ceph dashboard set-grafana-api-ssl-verify False

启用PROMETHEUS警报

指定Alertmanager服务器的主机和端口:

$ ceph dashboard set-alertmanager-api-host <alertmanager-host:port>

[ceph@ceph03 ~]$ ceph dashboard set-alertmanager-api-host 'http://192.168.23.19:9093'

为了能够查看所有已配置的警报,您将需要配置Prometheus API的URL。

ceph dashboard set-prometheus-api-host <prometheus-host:port>

[ceph@ceph03 ~]$ ceph dashboard set-prometheus-api-host 'http://192.168.23.19:9090'
文档更新时间: 2020-06-01 10:57   作者:子木