Spring Boot 2.1X+Prometheus +Grafana实现监控及可视化

看了网上存在的普遍的版本,却在整合过程中出现了prometheus监控不到项目数据的情况。然后决定写此版本。

Prometheus

官方文档:https://prometheus.io/docs/introduction/overview/

下载并运行Prometheus

官方下载最新的Prometheus,下载地址:https://prometheus.io/download/
这里以linux 2.13.1版本为例,下载解压:

tar xvfz prometheus-2.13.1.linux-amd64.tar.gz
cd prometheus-2.13.1.linux-amd64

配置Prometheus

Prometheus配置保存为名为的文件prometheus.yml:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # 默认监视其自身的健康状况
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

  # 需要监控的项目
  #项目名
  - job_name: 'xxx'
    metrics_path: '/prometheus'
	#需监控项目地址
    static_configs:
      - targets: ['localhost:8080']

启动Prometheus

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值