I try to get jvm information through jolokia,
Through the debug log, I see that the return value is obtained, but it is not written into the index.
uptime information can be written
Configuration
logging.level: debug
#metricbeat.config.modules:
# Mounted `metricbeat-daemonset-modules` configmap:
# path: ${path.config}/modules.d/*.yml
# Reload module configs as they change:
# reload.enabled: false
# To enable hints based autodiscover uncomment this:
metricbeat.autodiscover:
providers:
- type: kubernetes
host: ${NODE_NAME}
templates:
- condition.and:
- equals:
kubernetes.namespace: "sxc"
- not:
equals:
kubernetes.container.name: "heartbeat"
- not:
equals:
kubernetes.container.name: "metricbeat"
- not:
equals:
kubernetes.container.name: "eureka"
- module: jolokia
metricsets: ["jmx"]
http_method: 'GET'
hosts: "http://${data.host}:8080"
path: "/jolokia"
namespace: "sxc"
jmx.mappings:
- mbean: 'java.lang:type=MemoryPool,name=Metaspace'
attributes:
- attr: Usage
field: cp.usage
- mbean: 'java.lang:type=Runtime'
attributes:
- attr: Uptime
field: uptime
processors:
- add_cloud_metadata:
- add_host_metadata:
- add_kubernetes_metadata:
host: ${NODE_NAME}
output.elasticsearch:
hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
username: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}
the log
DEBUG [jolokia.jmx] jmx/config.go:371 Jolokia response body {"host": "172.24.0.94:8080", "host": "172.24.0.94:8080", "uri": "http://172.24.0.94:8080/jolokia/read/java.lang:name=Metaspace,type=MemoryPool/Usage?ignoreErrors=true&canonicalNaming=false", "body": "{\"request\":{\"mbean\":\"java.lang:name=Metaspace,type=MemoryPool\",\"attribute\":\"Usage\",\"type\":\"read\"},\"value\":{\"init\":0,\"committed\":146538496,\"max\":-1,\"used\":139674992},\"timestamp\":1597899961,\"status\":200}", "type": "response"}
DEBUG [jolokia.jmx] jmx/config.go:356 Jolokia request URI and body {"host": "172.24.0.94:8080", "httpMethod": "GET", "URI": "/read/java.lang:name=Metaspace,type=MemoryPool/Usage?ignoreErrors=true&canonicalNaming=false", "body": "", "type": "request"}