Loading

Prometheus监控JVM

监控WebLogic启动的的程序的JVM

 

1.  下载jmx采集器jmx_exporter

https://github.com/prometheus/jmx_exporter/releases 

 

2. 配置jmx_exporter

/wls/jmx-exporter/config.yml

---
startDelaySeconds: 0
hostPort: 127.0.0.1:3294
username:
password:
#jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:3294/jmxrmi
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
whitelistObjectNames: ["org.apache.cassandra.metrics:*"]
blacklistObjectNames: ["org.apache.cassandra.metrics:type=ColumnFamily,*"]
rules:
  - pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
    name: cassandra_$1_$2
    value: $3
    valueFactor: 0.001
    labels: {}
    help: "Cassandra metric $1 $2"
    cache: false
    type: GAUGE
    attrNameSnakeCase: false

  其中端口3294为jmx的监听端口

 

3. weblogic的启动脚本startWebLogic.sh开启jmx,并以javaagent的方式开启jmx

export USER_MEM_ARGS="-Xms1024m -Xmx2048m  -Dcom.sun.management.jmxremote.port=3294 -Dcom.sun.management.jmxremote.ssl=false  -Dcom.sun.management.jmxremote.authenticate=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder -javaagent:/wls/jmx-exporter/jmx_prometheus_javaagent-0.14.0.jar=6094:/wls/jmx-exporter/config.yml"

  其中端口6094为exporter的监听端口,访问http://192.168.0.23:6094/metrics可以看到采集到的监控信息。

 

posted @ 2020-12-28 11:09  头痛不头痛  阅读(1279)  评论(0编辑  收藏  举报