美文网首页Ceph分布式存储
⑥ prometheus+grafana监控Ceph集群

⑥ prometheus+grafana监控Ceph集群

作者: Linux丶晨星 | 来源:发表于2020-05-07 18:12 被阅读0次

    在新建的主机192.168.0.5

    一、安装grafana

    1、清华源下载
     [root@ceph-grafana-prometheus ~]# wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-6.7.3-1.x86_64.rpm
    2.安装grafana
    rpm -ivh grafana-6.7.3-1.x86_64.rpm
    或
    yum localinstall grafana-6.7.3-1.x86_64.rpm
    
    3.启动grafana并设为开机自启
    systemctl start grafana-server.service 
    systemctl enable grafana-server.service
    #grafana的默认端口为3000
    

    二、安装prometheus

    #1、下载安装包,下载地址
    wget https://github.com/prometheus/prometheus/releases/download/v2.18.0/prometheus-2.18.0.linux-amd64.tar.gz
    #2、解压压缩包
    tar xf prometheus-2.14.0.linux-amd64.tar.gz
    #3、将解压后的目录改名
    mv prometheus-2.18.0.linux-amd64 /opt/prometheus
    #4、查看prometheus版本
    cd /opt/prometheus/
    ./prometheus --version
    prometheus, version 2.18.0
    #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 restart prometheus
    systemctl enable prometheus
    #8、访问
    http://192.168.0.5:9090
    

    三、ceph mgr prometheus插件配置

    在cephnode01上配置

    #启动prometheus模块
    ceph mgr module enable prometheus
    #检查端口
    netstat -nltp | grep mgr 
    ceph -s (mgr在cephnode03上)
    #测试返回值
    curl 192.168.0.8:9283/metrics  
    #访问
    http://192.168.0.8:9283/metrics
    

    四、配置prometheus

    1、在 scrape_configs: 配置项下添加

    #每个job_name要分开
    vim prometheus.yml
      - job_name: 'ceph_cluster'
        honor_labels: true
        scrape_interval: 5s
        static_configs:
          - targets: ['192.168.0.8:9283']
            labels:
              instance: ceph
    

    2、重启prometheus服务

    systemctl restart prometheus
    

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

    浏览器-》 http://x.x.x.x:9090 -》status -》Targets
    

    五、配置grafana

    1、浏览器登录 grafana 管理界面

    http://192.168.0.5:3000/

    2、添加data sources,点击configuration--》data sources

    3、添加dashboard,点击HOME--》find dashboard on grafana.com

    4、搜索ceph的dashboard

    5、点击HOME--》Import dashboard, 选择合适的dashboard,记录编号

    6、检测成功

    7、也可以检测Cephfs文件系统

    相关文章

      网友评论

        本文标题:⑥ prometheus+grafana监控Ceph集群

        本文链接:https://www.haomeiwen.com/subject/hciaghtx.html