您当前的位置: 首页 > 

星夜孤帆

暂无认证

  • 2浏览

    0关注

    626博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Nacos监控Prometheus Grafana

星夜孤帆 发布时间:2020-11-14 13:47:19 ,浏览量:2

一、nacos集群暴露metrics数据

部署好nacos集群后,配置application.properties文件,暴露metrics数据

management.endpoints.web.exposure.include=*

多个节点按照上面配置,暴露metrics数据,然后重启nacos,

#如果有nginx,也可以通过nginx ip+port进行访问
localhost:8848/nacos/actuator/prometheus 
localhost:8848/nacos/actuator
localhost:8848/nacos/actuator/mappings

这里用了chrome插件JSON-handle

二、搭建Prometheus采集Nacos metrics数据

下载你想安装的prometheus版本,地址为download prometheus

tar xvfz prometheus-*.tar.gz
cd prometheus-*

修改配置文件Prometheus.yml采集nacos metrics数据

此处注意空格,否则报错

scrape_configs:
  # The job name is added as a label `job=` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
    
  - job_name: 'nacos'

    metrics_path: '/nacos/actuator/prometheus'
    static_configs:
    - targets: ['210.310.5.143:8848','110.330.5.182:8848','110.340.5.183:8848']

启动prometheus服务

./prometheus --config.file="prometheus.yml"
prometheus.exe --config.file=prometheus.yml

通过访问http://localhost:9090/graph可以看到prometheus的采集数据,在搜索栏搜索nacos_monitor可以搜索到Nacos数据说明采集数据成功

三、搭建grafana图形化展示metrics数据 3.1 安装与启动

和prometheus在同一台机器上安装grafana,使用 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

下载链接

windows运行

访问grafana: http://localhost:3000

3.2 配置prometheus数据源

3.3 导入nacos grafana监控模板

导入Nacos grafana监控模版  下载很慢提供gitee链接

3.4 nacos监控分为三个模块 3.4.1 nacos monitor展示核心监控项

3.4.2 nacos detail展示指标的变化曲线

3.4.3 nacos alert为警告项

参考1,参考2, 参考3,参考4

关注
打赏
1636984416
查看更多评论
立即登录/注册

微信扫码登录

0.0356s