您的位置:首页 > 运维架构

CEPH的学习笔记(七) 使用 Prometheus、ceph_exporter、Grafana监控 Ceph集群

2019-03-20 14:20 2376 查看

CEPH的学习笔记(七) 使用 Prometheus、ceph_exporter、Grafana监控 Ceph集群

参考资料:https://www.jianshu.com/p/f0fae97d9349

1.1 安装 Prometheus

  1. 下载并解压Prometheus安装包 :
wgethttps://github.com/prometheus/prometheus/releases/download/v2.0.0/prometheus-2.0.0.linux-amd64.tar.gz
tar zxvf prometheus-2.0.0.linux-amd64.tar.gz



2. 进入prometheus目录并复制prometheus文件到指定目录 :

cd prometheus-2.0.0.linux-amd64/
sudo cp prometheus /usr/bin/
sudo cp promtool /usr/bin/


3. 编辑prometheus的配置文件 :

vi  /lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus: the monitoring system
Documentation=http://prometheus.io/docs/
[Service]
ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --           storage.tsdb.path=/var/lib/prometheus --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries --web.listen-address=0.0.0.0:9090 --web.external-url=Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target


4. 新建文件夹 /etc/prometheus/,并复制prometheus文件到指定目录 :

mkdir /etc/prometheus/
cp -R consoles console_libraries prometheus.yml /etc/prometheus/


5. **新建文件夹/var/lib/prometheus/,并启动prometheus服务:

mkdir /var/lib/prometheus/
systemctl daemon-reload
systemctl enable prometheus.service
systemctl start prometheus.service


6. 此时,可以在浏览器中查看prometheus服务是否启动:
在浏览器中输入ip:9090或者ip:9090/graph:

1.2 安装 ceph_exporter

  1. 拉取ceph_exporter镜像,并以docker容器的方式运行:
docker pull docker.io/digitalocean/ceph_exporter  或者:
docker pull 10.10.10.25:5000/ceph_exporter
docker tag 10.10.10.25:5000/ceph_exporter digitalocean/ceph_exporter
docker run -d --name=ceph_exporter --net=host -v /data/ceph/etc/ceph:/etc/ceph  -p=9128:9128  -it docker.io/digitalocean/ceph_exporter


2. 此时,可以在浏览器中查看ceph_exporter服务是否启动:
在浏览器中输入ip:9128:

3. 修改prometheus配置文件,并重启prometheus服务:

vim /etc/prometheus/prometheus.yml
...
scrape_configs:
- job_name: 'ceph_exporter'
static_configs:
- targets: ['localhost:9128']
labels:
alias: ceph_exporter
...
systemctl restart prometheus.service

1.3 安装Grafana

  1. 安装Grafana :
    参考资料:https://grafana.com/grafana/download
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.3.2-1.x86_64.rpm
yum localinstall grafana-5.3.2-1.x86_64.rpm


2. 启动Grafana服务 :

systemctl enable grafana-server
systemctl start grafana-server

1.4 配置 dashboard

  1. 在浏览器中输入http://localhost:3000(ip:3000) 来登录 Grafana,默认用户为 admin,密码也是 admin:
  2. 配置 data source,主要在Name、Type、URL(换成自己IP)、Access:
  3. 点击左边的“+”号,选择“import”,在弹出的界面中“Grafana.com Dashboard”栏中输入“917”,并点击“load”:

  4. 在弹出的界面按中设置“Name”、“Unique identifier(uid)”、“Prometheus”,其中“Prometheus”栏设置“prometheus”,点击“import”即可看到ceph集群的监控信息:


    此时,即可看到ceph集群的监控情况
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: