1.prometheus的配置
- job_name: 'java01' #按照这个来分组
scrape_interval: 10s
static_configs:
- targets: ['192.168.1.44:6060']
labels:
instance: jvm44
2. jmx-exporter/simple-config.yml #tomcat的启动参数文件
[root@k8s prom-jvm-demo]# cat simple-config.yml
---
rules:
- pattern: '.*'
这个文件在启动docker的时候用到
docker run -d \
--name tomcat-1 \
-v <path-to-prom-jvm-demo>:/jmx-exporter \
-e CATALINA_OPTS="-Xms64m -Xmx128m -javaagent:/jmx-exporter/jmx_prometheus_javaagent-0.3.1.jar=6060:/jmx-exporter/simple-config.yml" \
-p 6060:6060 \
-p 8080:8080 \
tomcat:8.5-alpine
用一个例子来演示会更加清晰