拉取 Prometheus ,grafana 镜像
docker pull prom/prometheus
docker pull grafana/grafana
启动 prometheus grafana 镜像
docker run -di --name=prometheus -p 9090:9090 --privileged=true prom/prometheus
docker run -di --name=grafana -p 3000:3000 --privileged=true grafana/grafana
访问 prometheus
http://192.168.119.130:9090/
访问 grafana
http://192.168.119.130:3000/
nacos 配置 prometheus
打开 /nacos/actuator/prometheus 的 endpoint ,默认是没有打开的
image.png
如果没有写到 nacos application.properties 配置文件中
management.endpoints.web.exposure.include=*
重启 nacos
docker restart nacos
访问 http://192.168.119.130:8848/nacos/actuator/prometheus
配置可视化面板
配置 prometheus
将 prometheus 中的 prometheus.yml 复制到宿主机任意目录
docker cp prometheus:/etc/prometheus/prometheus.yml ./
vim 打开 添加 nacos 节点
image.png
# 任务名称
- job_name: 'nacos'
# 访问收集数据的路径
metrics_path: '/nacos/actuator/prometheus'
# 监控的节点
static_configs:
# 节点地址集群的话配置多个用逗号隔开
- targets: ['192.168.119.130:8848']
:wq! 保存退出,cp 回到 prometheus 中
docker cp ./prometheus.yml prometheus:/etc/prometheus
重新启动 prometheus
docker restart prometheus
重新访问 prometheus
image.png
image.png
graph 中获取 nacos_monitor 信息
image.png
image.png
进入 grafana 配置 prometheus
image.png导入 nacos-grafana.json
下载地址
链接:https://pan.baidu.com/s/1R36sr7TgZ7gMw-qokyJegQ
提取码:akt1
选择下载的 nacos-grafana.json 导入 import
image.pngimage.png
image.png
image.png
网友评论