下载 prometheus
https://prometheus.io/download/
这里选择的是 prometheus-2.10.0.Linux-amd64.tar.gz
安装 prometheus
执行解压命令
tar -zxvf prometheus-2.10.0-rc.0.Linux-amd64.tar.gz
配置 prometheus
修改 prometheus.YAML,
VIM prometheus.YAML
在下方添加
- - job_name: 'micro-service'
- metrics_path: /actuator/prometheus
- serverset_sd_configs:
- - servers:
- - 'ip:2181'
- - 'ip:2181'
- - 'ip:2181'
- paths:
- - /prometheus
job_name 可以随意起
metrics_path: 是 spring-boot 提供的端点
servers: 配置 dubbo 注册中心 zk 的地址
启动 prometheus
nohup ./prometheus> prometheus.log &
下载安装 grafana
https://grafana.com/grafana/download
参照官网步骤进行下载安装, 下载速度略慢, 需要耐心等待
启动 grafana
service grafana-server start
启动可能会报错
查看 grafana 日志
VIM /var/log/grafana/grafana.log
在 / var/run 目录下创建 grafana 目录并修改所有者
- mkdir grafana
- chown grafana:grafana grafana
配置 prometheus 数据源
访问 ip:3000
选择 add data source
选择 Prometheus
将刚安装的 prometheus 信息配置在 url 中
推荐一个 Dashboard,ID 为 4701
来源: http://www.bubuko.com/infodetail-3096021.html