前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >springboot埋点监控

springboot埋点监控

作者头像
用户1215919
发布2021-12-28 12:47:03
9370
发布2021-12-28 12:47:03
举报
文章被收录于专栏:大大的微笑大大的微笑

SpringBoot配置

代码语言:javascript
复制
	management:
  server:
    port: 10091
  endpoints:
    web:
      exposure:
        include: '*'
      base-path: /management
prometheus(当前使用版本:2.19.0)

下载地址:https://prometheus.io/download/

配置文件内容(prometheus.yml):
代码语言:javascript
复制
# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
# windows ->(cmd进入目录执行) prometheus.exe --config.file=prometheus.yml
alerting:
  alertmanagers:
  - static_configs:
    - targets:
       - alertmanager:9090

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# 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'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    metrics_path: /management/prometheus
    static_configs:
	# 需要监控的端口
    - targets: ['localhost:10091'] 

默认端口9090

grafana(当前使用版本:7.0.3)

下载地址:https://grafana.com/grafana/download

默认端口3000

直接启动,默认账号admin/admin

配置prometheus

接口调用次数,和失败次数监控
依赖
grafana Dashboards(Spring Boot 2.1 Statistics)
  1. 配制数据源
  1. 导入springboot Dashboard
  1. 配置好的默认面板
  1. 增加自己的项目监控
使用docker运行
代码语言:javascript
复制
docker run  -d \
 -p 9090:9090 \
 --memory 40MB\
 -v /usr/local/gps/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml  \
 prom/prometheus

授权 chmod 777 -R /usr/local/grafana

代码语言:javascript
复制
  docker run -d \
-p 3000:3000 \
--memory 40MB\
--name=grafana \
-v /usr/local/gps/grafana:/var/lib/grafana \
grafana/grafana
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • prometheus(当前使用版本:2.19.0)
    • 配置文件内容(prometheus.yml):
    • grafana(当前使用版本:7.0.3)
    • 接口调用次数,和失败次数监控
    • 依赖
      • grafana Dashboards(Spring Boot 2.1 Statistics)
        • 使用docker运行
    相关产品与服务
    Grafana 服务
    Grafana 服务(TencentCloud Managed Service for Grafana,TCMG)是腾讯云基于社区广受欢迎的开源可视化项目 Grafana ,并与 Grafana Lab 合作开发的托管服务。TCMG 为您提供安全、免运维 Grafana 的能力,内建腾讯云多种数据源插件,如 Prometheus 监控服务、容器服务、日志服务 、Graphite 和 InfluxDB 等,最终实现数据的统一可视化。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档