无法使用来自kafka的jolokia提取jmx数据

cu6pst1q  于 2021-06-07  发布在  Kafka
关注(0)|答案(2)|浏览(1100)

我已经在centos 7机器上安装了jolokia,并尝试使用jolokia代理提取kafka度量,并使用nagios插件check jmx4perl与iSinga监控工具集成。下面是我遵循的配置步骤
步骤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:通过发出命令测试jolokia代理 j4psh http://localhost:8778 ```
Connection refused

我也尝试提供ip地址,但问题仍然是一样的。我需要在etc/hosts文件中输入主机吗?
wlwcrazw

wlwcrazw1#

不确定您是否与此问题相同,但:
也许您需要完全限定jar的路径。我的看起来像这样,而且有效:

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"

当我在非守护程序模式下启动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
pdtvr36n

pdtvr36n2#

添加到Kafka选项:

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

相关问题