--- /dev/null
+#!/bin/sh
+jconsole :7001
zookeeper:
build: zookeeper
environment:
+ JVMFLAGS:
+ -Dcom.sun.management.jmxremote=true
+ -Dcom.sun.management.jmxremote.port=7070
+ -Dcom.sun.management.jmxremote.authenticate=false
ALLOW_ANONYMOUS_LOGIN: 'yes'
+ ZOO_ENABLE_PROMETHEUS_METRICS: 'yes'
volumes:
- zookeeper:/bitnami/zookeeper
+ ports:
+ - 2181:2181
+ - 7000:7070
kafka-1:
build: kafka
environment:
+ KAFKA_OPTS:
+ -Dcom.sun.management.jmxremote=true
+ -Dcom.sun.management.jmxremote.port=7000
+ -Dcom.sun.management.jmxremote.authenticate=false
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9081
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT
- kafka-1:/bitnami/kafka
ports:
- 9081:9081
+ - 7001:7000
depends_on:
- zookeeper
kafka-2:
build: kafka
environment:
+ KAFKA_OPTS:
+ -Dcom.sun.management.jmxremote=true
+ -Dcom.sun.management.jmxremote.port=7000
+ -Dcom.sun.management.jmxremote.authenticate=false
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9082
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT
ports:
- 9092:9082
- 9082:9082
+ - 7002:7000
networks:
default:
aliases:
kafka-3:
build: kafka
environment:
+ KAFKA_OPTS:
+ -Dcom.sun.management.jmxremote=true
+ -Dcom.sun.management.jmxremote.port=7000
+ -Dcom.sun.management.jmxremote.authenticate=false
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CFG_LISTENERS: BROKER://:9092, LOCALHOST://:9083
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT
- kafka-3:/bitnami/kafka
ports:
- 9083:9083
+ - 7003:7000
depends_on:
- zookeeper
--- /dev/null
+root = true
+
+[*]
+indent_style = space
+indent_size = tab
+tab_width = 2
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = false
+
+[*.properties]
+charset = latin1
\ No newline at end of file
--- /dev/null
+*.iml
+.idea
+target
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>de.juplo.monitoring</groupId>
+ <artifactId>mbeans</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>ListMBeans</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ </properties>
+
+ <build>
+ <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+ <plugins>
+ <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.1.0</version>
+ </plugin>
+ <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.0.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.22.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.0.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.5.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ </plugin>
+ <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.7.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>3.0.0</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
--- /dev/null
+package de.juplo.monitoring;
+
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import java.util.Iterator;
+import java.util.Set;
+
+
+public class ListMBeans
+{
+ public static void main(String[] args)
+ {
+ String url = args.length > 0 ? args[0] : "service:jmx:rmi:///jndi/rmi://:7001/jmxrmi";
+ System.out.println("-------------------------------------------------");
+ try {
+ JMXServiceURL jmxServiceURL = new JMXServiceURL(url);
+ JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, null);
+
+ MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
+
+ Set result = connection.queryNames(new ObjectName("*:*"), null);
+ Iterator it = result.iterator();
+
+ while (it.hasNext())
+ {
+ ObjectName objectName = (ObjectName) it.next();
+
+ try
+ {
+ System.out.println("--> " + objectName.getCanonicalName());
+ MBeanAttributeInfo[] attributes = connection.getMBeanInfo(objectName).getAttributes();
+
+ for (int i = 0; i < attributes.length; i++)
+ {
+ System.out.println(" Attribute: " + attributes[i].getName() + " of Type : " + attributes[i].getType());
+ }
+
+ MBeanOperationInfo[] operations = connection.getMBeanInfo(objectName).getOperations();
+
+ for (int i = 0; i < operations.length; i++)
+ {
+ System.out.print(" Operation: " + operations[i].getReturnType() + " " + operations[i].getName() + "(");
+ for (int j = 0; j < operations[i].getSignature().length;j++)
+ {
+ System.out.print(operations[i].getSignature()[j].getName() +
+ ":" +
+ operations[i].getSignature()[j].getType() +
+ " ");
+ }
+ System.out.println(")");
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ jmxConnector.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ System.out.println("-------------------------------------------------");
+ }
+}