2

I have installed Jolokia in centos 7 machine and trying to pull Kafka metrics using Jolokia agent and integrate with Icinga monitoring tool using Nagios plugin check_jmx4perl. Below are the configuration steps I have followed

Step 1: Downloaded jolokia-jvm-1.3.4-agent.jar

Step 2: Copied to /home/usr/

Step 3: Provided permissions by issuing command chmod a+x /home/usr/jolokia-jvm-1.3.4.jar

Step 4: Added to class path by issuing command export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/home/usr/jolokia-jvm-1.3.4-agent.jar=host=*"

Step 5: Started Zookeeper and Kafka in standalone mode and tried to fetch list of topics which works fine by displaying the message

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/

Step 6: Testing jolokia agent by issuing the command j4psh http://localhost:8778

Connection refused

I have also tried by providing IP address but the issue still remains the same. Do I need to make an entry of the host in etc/hosts file?

user8363477
  • 655
  • 4
  • 14
  • 24
  • Just for info, we are using https://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/check_jmxeval/details to get JMX data from Kafka without problem. – Rohlik Sep 02 '17 at 08:02
  • @Rohlik : Can you please let me know the steps of configuration for Kafka? – user8363477 Sep 04 '17 at 09:16
  • Try use this https://stackoverflow.com/a/45452489/5102940 – Rohlik Sep 05 '17 at 13:53

2 Answers2

0

Not sure if you are same OP as this question, but:

Perhaps you need to fully qualify the path of the jar. Mine looks like this and works:

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"

When I start Kafka in non-daemon mode, it prints this:

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

Then I point my browser to http://localhost:7778/jolokia/search/: and I get:

{
  "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 also connects with:

j4psh http://localhost:7778/jolokia
Nicholas
  • 15,916
  • 4
  • 42
  • 66
  • Thank you for the reply. I followed the same steps but still getting the connection refused issue using j4psh followed by the url and the message Jolokia: Agent started with URL http://ipaddress:7778/jolokia/ only shows when I try to fetch the list of topics but not upon Kafka instance startup – user8363477 Aug 31 '17 at 15:11
0

Add to 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
Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
Vinayak Mishra
  • 341
  • 4
  • 11