Installing Kafka

Prerequisites

  • URL/IP of the SixthSense collector (your tenant URL which will be provided by Customer Support).
  • Access token from the SixthSense portal.
  • SixthSense JMX Agent (requires JRE 1.8 and above).
  • JMX host and port details of Kafka.

Enabling Kafka monitoring

SixthSense agent will remotely monitor Kafka i.e. the agent will run as a separate process and will connect to the JMX port exposed by Kafka for fetching the metrics. Below are the steps to enable Kafka monitoring:

  1. Enabling remote JMX support in Kafka through environment variables/JVM args.

    • (optional) Enabling authentication on the port exposed by Kafka for JMX remote monitoring.
    • JMX remote support can be enable through environment variable or JVM args:

    a. Need to pass “sun.management.jmxremote” as true in order to enable JMX remote support. Following are the other mandatory JVM arguments for configuring JMX remote. These JVM arguments will be picked by Kafka after restart.

Args

export KAFKA_OPTS="-Dcom.sun.management.jmxremote=true \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Djava.rmi.server.hostname=127.0.0.1 \ -Dcom.sun.management.jmxremote.port=1100"
  1. Downloading the SixthSense Agent.
  2. Configuring the SixthSense Agent.
  3. Running the SixthSense Agent.

Enabling Kafka producer monitoring

  1. Enabling remote JMX support in Kafka producer through environment variables/JVM args must pass while running the java producer application.
java -Dcom.sun.management.jmxremote.port=1200
-Dcom.sun.management.jmxremote.rmi.port=1200
-Djava.rmi.server.hostname=127.0.0.1
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false -jar
your_producer_java_application.jar

Enabling Kafka consumer monitoring

  1. Enabling remote JMX support in Kafka consumer through environment variables/JVM args must pass while running the java producer application.
java -Dcom.sun.management.jmxremote.port=1500
-Dcom.sun.management.jmxremote.rmi.port=1500
-Djava.rmi.server.hostname=127.0.0.1
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false -jar
your_consumer_java_application.jar

Enabling Authentication on port exposed

This will be done by Java-provided local JMX authentication method, which stores credentials and controls access using a local file

  • Create a new folder called jmxremote
> mkdir -vp /etc/jmxremote
  • Create two files in this directory

    • password
    • access
  • The password file has the credentials that the JMX agent will check during client authentication.

> cat /etc/jmxremote/jmxremote.password
sixthsense R@kuten@1234
info

Here the file content is registering the user "sixthsense" with password "R@kuten@1234"

  • The access file has authorization information that is who is allowed to do what.
> cat jmxremote/jmxremote.access
sixthsense readwrite
  • Change the permissions on both files so that only owner can edit and view them.
> chmod -R 600 /etc/jmxremote/jmxremote.*

Add the following sun.management.jmxremote.authenticate=true, com.sun.management.jmxremote.access.file=/etc/jmxremote/jmxremote.acces”s
com.sun.management.jmxremote.password.file=/etc/jmxremote/jmxremote.password” in JVM_ARGS.

It should look like the following:

DEBUG_ARGS="-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=127.0.0.1 \
-Dcom.sun.management.jmxremote.port=9010 "\
-Dcom.sun.management.jmxremote.access.file=/etc/jmxremote/jmxremote.access \
-Dcom.sun.management.jmxremote.password.file=/etc/jmxremote/jmxremote.password"

Downloading the agent

Prerequisites for downloading the agent

  • Private Token from the onboarding team.
  • Link to download a specific version.

To download the agent, perform the following procedure:

  1. Ensure there is ingress from the internet/SixthSense enabled.
  2. Download the agent using curl.
curl --header "PRIVATE-TOKEN:<token>" --output sixthsense-jmx-agent.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/48/packages/generic/sixthsense-jmx-agent/v2.1.0/sixthsense-jmx-agent.zip"

Configuring the agent

  1. Unzip the downloaded agent.
  2. Navigate to agent.config file i.e. Agent folder/config/agent.config file. The agent can be configured by adding the information in the agent.config file.

Following is a agent.config file section where brokers, producers, consumers and JMX host and port details must be updated:

Broker configuration

brokerConfigs:
- brokerUrl: ${SS_BROKER1_URL:localhost}
name: ${SS_BROKER1_URL:broker1}
brokerPort: ${SS_BROKER1_PORT:1100}
username: ${SS_BROKER1_USERNAME:}
password: ${SS_BROKER1_PASSWORD:}
configType: ${SS_CONFIG_TYPE:kafkabroker}

Producer configuration

- brokerUrl: ${SS_BROKER1_URL:localhost}
name : ${SS_BROKER1_URL:producer1}
brokerPort: ${SS_BROKER1_PORT:1200}
username: ${SS_BROKER1_USERNAME:}
password: ${SS_BROKER1_PASSWORD:}
configType: ${SS_CONFIG_TYPE:kafkaproducer}

Consumer configuration

- brokerUrl: ${SS_BROKER1_URL:localhost}
name : ${SS_BROKER1_URL:consumer1}
brokerPort: ${SS_BROKER1_PORT:1300}
username: ${SS_BROKER1_USERNAME:}
password: ${SS_BROKER1_PASSWORD:}
configType: ${SS_CONFIG_TYPE:kafkaconsumer}

Following is the section of agent.config file where agent general configuration must be updated.

agentConfig:
serviceName: ${SS_SERVICE_NAME:Artemis}
collectorBackendService: ${SS_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
agentAuthentication: ${SD_AGENT_AUTHENTICATION: <add token here>}
agentForceTls: ${SD_AGENT_FORCE_TLS:true}
logFileName: ${SS_LOGGING_FILE_NAME:sixthsense-api.log}
logLevel: ${SS_LOGGING_LEVEL:INFO}
collectorThreadCount: ${SS_COLLECTOR_THREAD_COUNT:1}
# Logging max_file_size, default: 5 * 1024 * 1024 = 5242880 // 5 MB
logMaxFileSize: ${SW_LOGGING_MAX_FILE_SIZE:5242880}

For OneCloud Platform, use the following command:

agentConfig:
serviceName: ${SS_SERVICE_NAME:Artemis}
collectorBackendService: ${SS_AGENT_COLLECTOR_BACKEND_SERVICES:133.237.176.44:80}
# For connectivity to backend using onecloud private network: 100.99.116.221:80
# For connectivity to backend using intra public network: 133.237.176.44:80
agentAuthentication: ${SD_AGENT_AUTHENTICATION: <add token here>}
agentForceTls: secure: false
logFileName: ${SS_LOGGING_FILE_NAME:sixthsense-api.log}
logLevel: ${SS_LOGGING_LEVEL:INFO}
collectorThreadCount: ${SS_COLLECTOR_THREAD_COUNT:1}
# Logging max_file_size, default: 5 * 1024 * 1024 = 5242880 // 5 MB
logMaxFileSize: ${SW_LOGGING_MAX_FILE_SIZE:5242880}
info

The agent will override the values of these configs if set through environment variables.

Running the agent

The agent will run as separate process and will connect to port exposed by ActiveMQ artemis. Use the following command to run the agent.

> java -jar sixthsense-jmx-agent.jar