Я написал приведенные ниже сопоставления JMX (mbean) для модуля jolokia в metricbeat, но не смог преобразовать его соответственно в экспортер prometheus jmx (tomcat.yml).
- module: jolokia
metricsets: ["jmx"]
hosts: ["localhost:8778"]
namespace: "jmx_metrics"
path: "/jolokia/"
period: 10s
http_method: "GET"
jmx.mappings:
- mbean: "java.nio:type=BufferPool,name=direct"
attributes:
- attr: Count
field: bufferPool.direct.bufferCount
- attr: MemoryUsed
field: bufferPool.direct.memoryUsed
- attr: TotalCapacity
field: bufferPool.direct.totalCapacity
- mbean: "java.nio:type=BufferPool,name=mapped"
attributes:
- attr: Count
field: bufferPool.mapped.bufferCount
- attr: MemoryUsed
field: bufferPool.mapped.memoryUsed
- attr: TotalCapacity
field: bufferPool.mapped.totalCapacity
Ниже показан экспортер JMX прометея - tomcat.yml
---
lowercaseOutputLabelNames: true
lowercaseOutputName: true
rules:
- pattern: 'Catalina<type=GlobalRequestProcessor, name=\"(\w+-\w+)-(\d+)\"><>(\w+):'
name: tomcat_$3_total
labels:
port: "$2"
protocol: "$1"
help: Tomcat global $3
type: COUNTER
- pattern: 'Catalina<j2eeType=Servlet, WebModule=//([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]), name=([-a-zA-Z0-9+/$%~_-|!.]*), J2EEApplication=none, J2EEServer=none><>(requestCount|maxTime|processingTime|errorCount):'
name: tomcat_servlet_$3_total
labels:
module: "$1"
servlet: "$2"
help: Tomcat servlet $3 total
type: COUNTER
экспортер JMX:
https://github.com/prometheus/jmx_exporter/blob/master/example_configs/tomcat.yml