主要內容更 監控參數說明
Maven坐標
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
SpringBoot2.0 Actuator監控指標分析
| 序號 |
參數 |
參數說明 |
是否監控 |
監控手段 |
重要度 |
| ---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 |
當前打開句柄數 |
是 |
監控文件句柄使用率,超過閾值后報警 |
重要 |
附錄
SpringBoot1.x的metrics信息
{
"mem":568029,
"mem.free":164376,
"processors":16,
"instance.uptime":223643888,
"uptime":223835542,
"systemload.average":0.18,
"heap.committed":415232,
"heap.init":419840,
"heap.used":250855,
"heap":415232,
"nonheap.committed":156480,
"nonheap.init":2496,
"nonheap.used":152797,
"nonheap":0,
"threads.peak":114,
"threads.daemon":99,
"threads.totalStarted":234,
"threads":113,
"classes":15474,
"classes.loaded":15474,
"classes.unloaded":0,
"gc.ps_scavenge.count":1808,
"gc.ps_scavenge.time":99224,
"gc.ps_marksweep.count":3,
"gc.ps_marksweep.time":5314
}
SpringBoot2.0的metrics信息
{
"names":[
"jvm.memory.committed",
"http.server.requests",
"jvm.buffer.memory.used",
"jvm.gc.memory.allocated",
"tomcat.sessions.created",
"tomcat.sessions.expired",
"jvm.memory.used",
"tomcat.global.error",
"jvm.gc.max.data.size",
"system.cpu.count",
"jvm.memory.max",
"tomcat.global.sent",
"jvm.buffer.total.capacity",
"jvm.buffer.count",
"process.files.max",
"jvm.threads.daemon",
"process.start.time",
"tomcat.sessions.active.max",
"tomcat.global.request.max",
"jvm.gc.live.data.size",
"process.files.open",
"process.cpu.usage",
"tomcat.threads.current",
"tomcat.servlet.request",
"jvm.gc.pause",
"process.uptime",
"tomcat.threads.busy",
"system.load.average.1m",
"tomcat.cache.hit",
"tomcat.global.request",
"tomcat.servlet.error",
"tomcat.servlet.request.max",
"tomcat.cache.access",
"tomcat.sessions.active.current",
"system.cpu.usage",
"jvm.threads.live",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"jvm.threads.peak",
"tomcat.threads.config.max",
"jvm.gc.memory.promoted",
"tomcat.sessions.rejected",
"tomcat.global.received",
"tomcat.sessions.alive.max"
]
}