# Metricbeat kubernetes module

**URL:** https://discuss.elastic.co/t/metricbeat-kubernetes-module/245704
**Category:** Beats
**Tags:** beats-module, metricbeat
**Created:** [August 20, 2020, 5:15am UTC](https://discuss.elastic.co/t/metricbeat-kubernetes-module/245704 "2020-08-20T05:15:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ZMMWMY](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@ZMMWMY](https://discuss.elastic.co/u/ZMMWMY)
#### Post date: [August 20, 2020, 5:15am UTC](https://discuss.elastic.co/t/metricbeat-kubernetes-module/245704/1 "2020-08-20T05:15:43Z")

</div>

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

```auto
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

```auto
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"}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 17, 2020, 7:15am UTC](https://discuss.elastic.co/t/metricbeat-kubernetes-module/245704/2 "2020-09-17T07:15:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
