Nacos 接入 Prometheus 監控
系列文章目錄
- Prometheus 的安裝部署
- Grafana的安裝部署
- Linux服務器接入Prometheus監控-Node Exporter 安裝指南
- Prometheus 接入SpringBoot微服務監控
- Mysql 接入 Prometheus
- RocketMQ 接入Prometheus 監控
- ElasticSearch 接入 Prometheus
- Nacos 接入 Prometheus 監控
- Redis 接入 Prometheus 監控系統
- Prometheus + Grafana 監控系統-告警規則配置
- Prometheus + Grafana 監控系統-PrometheusAlert安裝與配置指南
-
官方參考: https://nacos.io/zh-cn/docs/monitor-guide.html
- Nacos 0.8.0版本完善了監控系統,支持通過暴露metrics數據接入第三方監控系統監控Nacos運行狀態,目前支持prometheus、elastic search和influxdb,
- 無需額外安裝單獨的 explorer
-
開啟 Nacos 自帶的prometheus監控端點(如果是已經存在的集群,那么需要為每個節點都修改此配置,并且重啟生效)
-
配置application.properties文件,暴露metrics數據
# 通常建議設置management.endpoints.web.exposure.include=health,info,metrics,prometheus ,不建議直接設置 * ,導致開放全部。 management.endpoints.web.exposure.include=prometheus
-
訪問 curl http://{nacos_ip}:{pord}/nacos/actuator/prometheus ,看是否能訪問到metrics數據
- Tips: 生產環境中,建議在nacos 集群的 vip 機制中,利用流量摘除方式實現逐個重啟。
/home/work/software/nacos/bin/shutdown.sh /home/work/software/nacos/bin/startup.sh
- Tips: 生產環境中,建議在nacos 集群的 vip 機制中,利用流量摘除方式實現逐個重啟。
-
-
集成到 Prometheus
scrape_configs: - job_name: 'nacos'metrics_path: /nacos/actuator/prometheusstatic_configs:- targets:- ip1:8848labels:instance: Nacos_node1- targets:- ip2:8848labels:instance: Nacos_node2- targets:- ip:8848labels:instance: Nacos_node3
- 或者簡單配置
scrape_configs:- job_name: 'Nacos'metrics_path: '/nacos/actuator/prometheus'static_configs:- targets: ['{ip1}:8848','{ip2}:8848','{ip3}:8848']
-
Grafana 中添加儀表盤
- https://grafana.com/grafana/dashboards/13221-nacos/