Prometheus和Grafana監控Nacos

Nacos 0.8.0版本完善了監控系統,支持通過暴露metrics數據接入第三方監控系統監控Nacos運行狀態,目前支持prometheus、elastic search和influxdb,下面結合prometheus和grafana如何監控Nacos,官網grafana監控頁面。與elastic search和influxdb結合可自己查找相關資料

Nacos集羣暴露metrics數據

集羣每個節點中修改配置application.properties文件,暴露metrics數據

cd /workspace/nacos/conf

vim application.properties

management.endpoints.web.exposure.include=*

看是否能訪問到metrics數據

http://xx.xx.xx.xx:8848/nacos/actuator/prometheus

image.png

部署prometheus採集Nacos metrics數據

下載地址爲download prometheus


解壓prometheus壓縮包並安裝

tar xvfz prometheus-*.tar.gz /workspace/

cd /workspace/prometheus

修改配置文件,注意格式縮進

vim prometheus.yml

  - job_name: 'nacos-cluster'

    scrape_interval: 60s

    metrics_path: '/nacos/actuator/prometheus'

    static_configs:

      - targets:

         - 110.60.40.42:8848

         - 110.90.5.47:8848

         - 110.9.50.15:8848

啓動prometheus服務

cd /workspace/prometheus

nohup ./prometheus --config.file="prometheus.yml" &

通過瀏覽器檢查prometheus數據,http://xx.xx.xx.xx:9090/graph

可以看到prometheus的採集數據,在搜索欄搜索nacos_monitor可以搜索到Nacos數據說明採集數據成功

image.png


部署grafana圖形化展示metrics數據

使用 yum 安裝grafana

sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.4-1.x86_64.rpm

sudo service grafana-server start

登錄grafana  默認賬號密碼:admin

http://xx.xx.xx.xx:3000/?orgId=1


配置prometheus數據源


image.png

image.png


導入Nacos grafana監控模版

下載地址:https://github.com/nacos-group/nacos-template

image.png

Nacos監控分爲三個模塊:

  • nacos monitor展示核心監控項

image.png

  • nacos detail展示指標的變化曲線

image.png

  • nacos alert爲告警項

image.png

Nacos-Sync監控

隨着Nacos 0.9版本發佈,Nacos-Sync 0.3版本支持了metrics監控,能通過metrics數據觀察Nacos-Sync服務的運行狀態,提升了Nacos-Sync的在生產環境的監控能力。 整體的監控體系的搭建參考Nacos監控手冊

grafana監控Nacos-Sync

和Nacos監控一樣,Nacos-Sync也提供了監控模版,導入監控模版

image.png

Nacos-Sync監控同樣也分爲三個模塊:

  • nacos-sync monitor展示核心監控項

image.png

  • nacos-sync detail和alert展示監控曲線和告警

image.png


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章