場景
? ? ? ??
準(zhǔn)備
- prometheus已經(jīng)部署pushgateway服務(wù),訪問{pushgateway.server:9091}可以看到面板
實現(xiàn)
- 基于springboot引入支持組件,版本可以
<!--監(jiān)控檢查-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.5.14</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>0.16.0</version>
</dependency>
- 開啟配置
management:
endpoints:
web:
exposure:
# 暴露監(jiān)控接口,*為全部接口
include: '*'
# 不暴露接口
# exclude: 'info'
metrics: #是否在內(nèi)存中保存監(jiān)控統(tǒng)計數(shù)據(jù)
export:
simple:
enabled: false # 關(guān)閉內(nèi)存中計算指標(biāo)
prometheus:
enabled: true # 開啟prometheus上傳
pushgateway: ## 配置pushgateway信息
enabled: true # 開啟pushgateway上傳
base-url: http://10.111.11.111:9091 # 配置pushgateway服務(wù)地址
job: ${spring.application.name} # 配置pushgateway服務(wù)地址
grouping-key:
instance: ${spring.application.name}:${spring.profiles.active}
lable1: labelValue1 # 自定義tag
push-rate: 10s #上傳數(shù)據(jù)間隔
?效果
? ? ? ? ?在pushgateway面板中會顯示新增的服務(wù),在prometheus中也可能看到采集的數(shù)據(jù)文章來源:http://www.zghlxwxcb.cn/news/detail-658538.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-658538.html
到了這里,關(guān)于actuator/prometheus使用pushgateway上傳jvm監(jiān)控數(shù)據(jù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!