工程

通过 Metricbeat 和 Jolokia 监测 Java 应用

Java (JVM) JMXJava Jolokia Elastic Stack JMX JMX Jolokia Metricbeat

JMX JConsole

JMX Java JMX managed bean MBeanMBean JVM MBean JVM 使JMX MBean MBean JVM MBean Java 访 JMX API API Jolokia 便 HTTPJConsole JMX 使 Java Runtime Java Java JConsole

JConsole welcome screen

线 MBean

JConsole main window

MBean Mbean java.lang JVM MBean MBean MBean Tomcat Kafka使 JMX

MBean browser in JConsole

JConsole Metricbeat Jolokia 便

使 Metricbeat Jolokia JMX

Metricbeat Elasticsearch Kibana 便JMX Java Jolokia Jolokia JVM REST-like HTTP JVM MBean Java 使 Jolokia JVM Java EE WAR OSGI Mule Jolokia Java 使 -javaagent 使 Java 使 Kafka KAFKA_OPTS

export KAFKA_OPTS=-javaagent:/opt/jolokia-jvm-1.5.0-agent.jar=port=8778,host=localhost
./bin/kafka-server-start.sh ./config/server.properties

Jolokia WAR Java EE Tomcat WAR webapps 便 Java Jolokia JVM JolokiaJolokia 便使 JVM JMXJolokia JVM 使 Jolokia JMX Metricbeat 5.4 Metricbeat JMX Jolokia JMX Metricbeat Jolokia

使 Metricbeat Jolokia Java

Jolokia 8778 Kafka 使 JConsole MBean MBean

Threading MBean in JConsole

java.lang:type=Threading MBean 线 java.lang:type=Memory MBean 使

- module: jolokia
  metricsets: ["jmx"]
  hosts: ["localhost:8778"]
  period: 10s
  namespace: "jvm"
  jmx.mappings:
  - mbean: "java.lang:type=Memory"
    attributes:
    - attr: "HeapMemoryUsage"
        field: "memory.heap"
    - attr: "NonHeapMemoryUsage"
        field: "memory.nonheap"
  - mbean: "java.lang:type=Threading"
    attributes:
    - attr: "ThreadCount"
        field: "thread.count"
    - attr: "DaemonThreadCount"
        field: "thread.daemon"

Metricbeat JConsole 线Metricbeat jolokia.jvm

Event with the collected jolokia metrics

Metricbeat 6.3 JMX 线

  jmx.mappings:
  - mbean: "java.lang:type=Memory"
    attributes:
    - attr: "HeapMemoryUsage"
        field: "memory.heap"
        event: "memory"
    - attr: "NonHeapMemoryUsage"
        field: "memory.nonheap"
        event: "memory"
  - mbean: "java.lang:type=Threading"
    attributes:
    - attr: "ThreadCount"
      field: "thread.count"
      event: "threads"
    - attr: "DaemonThreadCount"
      field: "thread.daemon"
      event: "threads"

6.3 MBean 使 Tomcat 线线

  - mbean: "Catalina:name=*,type=ThreadPool"
    attributes:
    - attr: "currentThreadCount"
      field: "thread.count"
    - attr: "maxThreads"
      field: "thread.max"
    - attr: "connectionCount"
      field: "connection.count"

MBean MBean

Event with the collected Jolokia metrics when using wildcards

Jolokia Jolokia Discovery Metricbeat 6.4 Java Jolokia Discovery UDP Jolokia autodiscover Kubernetes Docker Jolokia Discovery线

metricbeat.autodiscover:
  providers:
  - type: jolokia
    templates:
    - condition:
        contains:
          jolokia.agent.version: "1.5.0"
      config:
      - module: "jolokia"
        metricsets: ["jmx"]
        hosts: ["${data.jolokia.url}"]
        namespace: "jvm"
        jmx.mappings: 
        - mbean: "java.lang:type=Threading"
          attributes:
          - attr: "ThreadCount"
            field: "thread.count"
    - condition:
        contains:
          jolokia.server.product: "tomcat"
      config:
      - module: "jolokia"
        metricsets: ["jmx"]
        hosts: ["${data.jolokia.url}"]
        namespace: "jvm"
        jmx.mappings:
        - mbean: "Catalina:name=*,type=ThreadPool"
          attributes:
          - attr: "currentThreadCount"
            field: "thread.count"

Jolokia Tomcat 使 JMX 使 filebeat使 Jolokia autodiscover Discuss

  • 招聘中

    就职于一个全球分布式的团队,只需通过一次 Zoom 会议,就可在团队中找到与您工作方式相同的同事。具有影响力地灵活工作?从一开始就有发展机会?