无法使用Kafka的Jolokia提取JMX数据



我已经在Centos 7机器中安装了Jolokia,并尝试使用Jolokia代理来拉动Kafka指标,并使用Nagios Plugin check_jmx4perl与ICINGA监视工具集成。以下是我遵循的配置步骤

步骤1:下载JOLOKIA-JVM-1.3.4-AGENT.JAR

步骤2:复制到/home/usr/

步骤3:通过发出命令chmod a+x /home/usr/jolokia-jvm-1.3.4.jar

提供权限

步骤4:通过发出命令export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/home/usr/jolokia-jvm-1.3.4-agent.jar=host=*"

添加到类路径

步骤5:以独立模式启动Zookeeper和Kafka,并尝试获取通过显示消息

来获取正常工作的列表
INFO: No access restrictor found, access to all MBean is allowed
Jolokia: Agent started with URL http://0:0:0:0:0:0:0:0:8778/jolokia/

步骤6:通过发出命令j4psh http://localhost:8778

来测试Jolokia代理
Connection refused

我还尝试了提供IP地址,但问题仍然相同。我需要在etc/hosts文件中输入主机吗?

不确定您是否与此问题相同,但是:

也许您需要充分限定罐子的路径。我的看起来像这样,可以工作:

export JOLOKIA_HOME=/libs/java/jolokia/1.3.7
export JOLOKIA_JAR=$JOLOKIA_HOME/jolokia-jvm-1.3.7-agent.jar
export KAFKA_OPTS="-javaagent:$JOLOKIA_JAR=port=7778,host=* $KAFKA_OPTS"

当我以非daemon模式启动kafka时,它会打印以下:

I> No access restrictor found, access to any MBean is allowed
Jolokia: Agent started with URL http://10.8.36.121:7778/jolokia/

然后,我将浏览器指向http://localhost:7778/jolokia/search/

{
  "request": {
    "mbean": "*:*",
    "type": "search"
  },
  "value": [
    "kafka.network:name=ResponseQueueTimeMs,request=ListGroups,type=RequestMetrics",
    "kafka.server:delayedOperation=topic,name=PurgatorySize,type=DelayedOperationPurgatory",
    "kafka.server:delayedOperation=Fetch,name=NumDelayedOperations,type=DelayedOperationPurgatory",
    "kafka.network:name=RemoteTimeMs,request=Heartbeat,type=RequestMetrics",
<-- SNIP -->
    "kafka.network:name=LocalTimeMs,request=Offsets,type=RequestMetrics"
  ],
  "timestamp": 1504188793,
  "status": 200
}

J4PSH也可以与:

连接
j4psh http://localhost:7778/jolokia

添加到kafka_opts:

javaagent:/usr/share/java/kafka/jolokia-jvm-1.6.0-agent.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.rmi.port=9999  -Djava.security.auth.login.config=/var/private/sasl_acl/kafka.server.jaas.config

相关内容

  • 没有找到相关文章

最新更新