监控框架 - prometheus - 参数指标
基于SpringBoot2.0+ Actuator metrics的监控(基于Oracle JDK9,G1)
引言
SpringBoot2在spring-boot-actuator中引入了micrometer,对1.x的metrics进行了重构,另外支持对接的监控系统也更加丰富(Atlas、Datadog、Ganglia、Graphite、Influx、JMX、NewRelic、Prometheus、SignalFx、StatsD、Wavefront)。本文以Prometheus为例阐述SpringBoot2.0的监控。
springboot2.0接入
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.1.5<version>
</dependency>
application.yml
#======================= prometheus配置 ========================================#
management:
endpoints:
web:
exposure:
include: "*"
metrics:
tags:
application: ${spring.application.name}
注入bean
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; @Bean
MeterRegistryCustomizer<MeterRegistry> configurer(@Value("${spring.application.name}") String applicationName){
return registry -> registry.config().commonTags("application", applicationName);
}
访问
ip+端口/actuator/prometheus
SpringBoot2.0 Actuator监控指标分析
查看ip+端口/actuator/prometheus. 搜索指定关键字 注意关键字 jvm.memory.max 在搜索的时候应该是 jvm_memory_max
| 序号 | 参数 | 参数说明 | 是否监控 | 监控手段 | 重要度 |
|---|---|---|---|---|---|
| --- | JVM | --- | |||
| 1 | jvm.memory.max | JVM最大内存 | |||
| 2 | jvm.memory.committed | JVM可用内存 | 是 | 展示并监控堆内存和Metaspace | 重要 |
| 3 | jvm.memory.used | JVM已用内存 | 是 | 展示并监控堆内存和Metaspace | 重要 |
| 4 | jvm.buffer.memory.used | JVM缓冲区已用内存 | |||
| 5 | jvm.buffer.count | 当前缓冲区数 | |||
| 6 | jvm.threads.daemon | JVM守护线程数 | 是 | 显示在监控页面 | |
| 7 | jvm.threads.live | JVM当前活跃线程数 | 是 | 显示在监控页面;监控达到阈值时报警 | 重要 |
| 8 | jvm.threads.peak | JVM峰值线程数 | 是 | 显示在监控页面 | |
| 9 | jvm.classes.loaded | 加载classes数 | |||
| 10 | jvm.classes.unloaded | 未加载的classes数 | |||
| 11 | jvm.gc.memory.allocated | GC时,年轻代分配的内存空间 | |||
| 12 | jvm.gc.memory.promoted | GC时,老年代分配的内存空间 | |||
| 13 | jvm.gc.max.data.size | GC时,老年代的最大内存空间 | |||
| 14 | jvm.gc.live.data.size | FullGC时,老年代的内存空间 | |||
| 15 | jvm.gc.pause | GC耗时 | 是 | 显示在监控页面 | |
| --- | TOMCAT | --- | |||
| 16 | tomcat.sessions.created | tomcat已创建session数 | |||
| 17 | tomcat.sessions.expired | tomcat已过期session数 | |||
| 18 | tomcat.sessions.active.current | tomcat活跃session数 | |||
| 19 | tomcat.sessions.active.max | tomcat最多活跃session数 | 是 | 显示在监控页面,超过阈值可报警或者进行动态扩容 | 重要 |
| 20 | tomcat.sessions.alive.max.second | tomcat最多活跃session数持续时间 | |||
| 21 | tomcat.sessions.rejected | 超过session最大配置后,拒绝的session个数 | 是 | 显示在监控页面,方便分析问题 | |
| 22 | tomcat.global.error | 错误总数 | 是 | 显示在监控页面,方便分析问题 | |
| 23 | tomcat.global.sent | 发送的字节数 | |||
| 24 | tomcat.global.request.max | request最长时间 | |||
| 25 | tomcat.global.request | 全局request次数和时间 | |||
| 26 | tomcat.global.received | 全局received次数和时间 | |||
| 27 | tomcat.servlet.request | servlet的请求次数和时间 | |||
| 28 | tomcat.servlet.error | servlet发生错误总数 | |||
| 29 | tomcat.servlet.request.max | servlet请求最长时间 | |||
| 30 | tomcat.threads.busy | tomcat繁忙线程 | 是 | 显示在监控页面,据此检查是否有线程夯住 | |
| 31 | tomcat.threads.current | tomcat当前线程数(包括守护线程) | 是 | 显示在监控页面 | 重要 |
| 32 | tomcat.threads.config.max | tomcat配置的线程最大数 | 是 | 显示在监控页面 | 重要 |
| 33 | tomcat.cache.access | tomcat读取缓存次数 | |||
| 34 | tomcat.cache.hit | tomcat缓存命中次数 | |||
| --- | CPU... | --- | |||
| 35 | system.cpu.count | CPU数量 | |||
| 36 | system.load.average.1m | load average | 是 | 超过阈值报警 | 重要 |
| 37 | system.cpu.usage | 系统CPU使用率 | |||
| 38 | process.cpu.usage | 当前进程CPU使用率 | 是 | 超过阈值报警 | |
| 39 | http.server.requests | http请求调用情况 | 是 | 显示10个请求量最大,耗时最长的URL;统计非200的请求量 | 重要 |
| 40 | process.uptime | 应用已运行时间 | 是 | 显示在监控页面 | |
| 41 | process.files.max | 允许最大句柄数 | 是 | 配合当前打开句柄数使用 | |
| 42 | process.start.time | 应用启动时间点 | 是 | 显示在监控页面 | |
| 43 | process.files.open | 当前打开句柄数 | 是 | 监控文件句柄使用率,超过阈值后报警 | 重要 |
监控dashboard可使用grafana。
常见运算符
(a) = 等号 表示 精确匹配
(b) != 表示 不等于提供的字符串
(c) =~ 表示 正则匹配
(d) !~ 表示 正则不匹配
prometheus使用文档
https://fuckcloudnative.io/prometheus/3-prometheus/functions.html
监控框架 - prometheus - 参数指标的更多相关文章
- 监控框架 - prometheus
1.关于Prometheus Prometheus是一个根据应用的metrics来进行监控的开源工具.相信很多工程都在使用它来进行监控,有关详细介绍可以查看官网:https://prometheus. ...
- Inotify: 高效、实时的Linux文件系统事件监控框架
Inotify: 高效.实时的Linux文件系统事件监控框架 概要 - 为什么需要监控文件系统? 在日常工作中,人们往往需要知道在某些文件(夹)上都有那些变化,比如: 通知配置文件的改变 ...
- Kafka监控框架介绍
前段时间在想Kafka怎么监控.怎么知道生产的消息或消费的消费是否有丢失,目前有几个开源的Kafka监控框架这里整理了下,不过这几个框架都有各自的问题侧重点不一样: 1.Kafka Monitor 2 ...
- akka监控框架设计
本博客介绍一种AOP.无侵入的akka监控方案,方便大家在生产使用akka的过程中对akka进行监控. 对于自身javaer来说,AOP三个字母基本就解释清楚了akka监控框架的原理.哈哈哈,不过我这 ...
- 你必须知道的容器监控 (3) Prometheus
本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章.上一篇介绍了Google开发的容器监控工具cAdvisor,但是其提供的操作界面 ...
- Spring Boot Metrics监控之Prometheus&Grafana(转)
欢迎来到Spring Boot Actuator教程系列的第二部分.在第一部分中,你学习到了spring-boot-actuator模块做了什么,如何配置spring boot应用以及如何与各样的ac ...
- 性能测试之服务器监控和Prometheus推荐
服务器的监控,也是采用Prometheus和Grafana.可以监控服务器系统负载.CPU使用率.网络流量.磁盘使用率.磁盘读写速度.IO耗时.网络信息. 效果图 安装使用 安装启动node_expo ...
- 第七模块 :微服务监控告警Prometheus架构和实践
119.监控模式分类~1.mp4 logging:日志监控,Logging 的特点是,它描述一些离散的(不连续的)事件. 例如:应用通过一个滚动的文件输出 Debug 或 Error 信息,并通过日志 ...
- Docker监控平台prometheus和grafana,监控redis,mysql,docker,服务器信息
Docker监控平台prometheus和grafana,监控redis,mysql,docker,服务器信息 一.通过redis_exporter监控redis 1.1 下载镜像 1.2 运行服务 ...
随机推荐
- Windows与MAC使用差异有感(还会不断更新体验)
Windows与MAC使用差异有感(还会不断更新体验) 关于键盘 这上是MAC与Windows的⌨️按键区别 我们现在都是USB键盘,而PS/2键盘是已经淘汰掉的(插头是圆孔的),看上图会发现Comm ...
- 2020牛客NOIP赛前集训营-提高组(第三场)C-牛半仙的妹子Tree【虚树,最短路】
正题 题目链接:https://ac.nowcoder.com/acm/contest/7609/C 题目大意 给出\(n\)个点的一棵树,\(m\)个时刻各有一个操作 标记一个点,每个点被标记后的每 ...
- AT4519-[AGC032D]Rotation Sort【dp】
正题 题目链接:https://www.luogu.com.cn/problem/AT4519 题目大意 给出一个长度为\(n\)的排列,每次可以选择一个区间,然后花费\(A\)的代价向左旋转(最左边 ...
- HashMap的tableSizeFor解析
我们都知道,对于HashMap来说,数组的容量为2的倍数,但是我们可以在创建map的时候传入一个数组的大小 此时,这个初始化数组大小会传给一个双参的构造器 1. 创建HashMap public st ...
- 【C++ Primer Plus】编程练习答案——第10章
1 // chapter10_1_account.h 2 3 #ifndef LEARN_CPP_CHAPTER10_1_ACCOUNT_H 4 #define LEARN_CPP_CHAPTER10 ...
- Azure Devops实践(5)- 构建springboot项目打包docker镜像及容器化部署
使用Azure Devops构建java springboot项目,创建镜像并容器化部署 1.创建一个springboot项目,我用现有的项目 目录结构如下,使用provider项目 在根目录下添加D ...
- B - Ancient Cipher POJ - 2159 解题报告
内容: Ancient Roman empire had a strong government system with various departments, including a secret ...
- 【数据结构】<栈的应用>回文判断
通过栈与队列相关内容的学习,我们知道,栈是"先进后出"的线性表,而队列是"先进先出"的线性表.可以通过构造栈与队列来实现在这一算法.将要判断的字符序列依次压栈和 ...
- nmap常用命令汇总
nmap常用命令 选项 解释 使用举例 举例说明 Nmap主机发现 -sP Ping扫描 -P0 无Ping扫描 -PS TCP SYN Ping扫描 -PA TCP ACK ...
- tomcat内存马原理解析及实现
内存马 简介 Webshell内存马,是在内存中写入恶意后门和木马并执行,达到远程控制Web服务器的一类内存马,其瞄准了企业的对外窗口:网站.应用.但传统的Webshell都是基于文件类型的,黑客 ...