SonarQube Monitoring with Tanzu Wavefront Observability: Telegraf, Jolokia Agent, Mbeans

PAGE CONTENTS
Goal
Applicable Environment Details & Assumptions
Step-by-Step Guide

Goal

SonarQube Monitoring with Tanzu Wavefront Observability: Deploy Wavefront Proxy & Telegraf, Jolokia Agent.

Applicable Environment Details & Assumptions

  1. Ubuntu 16.04.1 LTS (Xenial Xerus)
  2. SonarQube 8.9 LTS
  3. Tanzu Wavefront Observability Access
  4. Wavefront Proxy with Telegraf & Jolokia Agent in JVM

Step-by-Step Guide

1. log in to Tanzu Wavefront Observability and Click on Integrations > JMX > Setup

2. Install Wavefront Proxy & Telegraf Agent: Run the following command on the host that you want to install the proxy and agent. (api-token & proxy port is unique to your installation)

sudo bash -c "$(curl -sL https://wavefronthq.github.io/wavefront-cli/install.sh)" -- install \
    --proxy \
    --wavefront-url https://abc.wavefront.com \
    --api-token 6xxxxxx9-6xx4-4xx4-bxx0-d12345678902 \
    --agent \
    --proxy-address localhost \
    --proxy-port 2222

3. Your output should contain the following information to ascertain that the Telegraf and Wavefront Proxy installation has been successful. 

4. Determine the Type of Jolokia Agent. Determine what type of agent you wish to use from https://jolokia.org/agent.html . I have decided to use Jolokia JVM Agent.

5. Download the Jolokia JVM Agent and rename it to agent.jar file. (I downloaded jolokia-jvm-1.7.1.jar). 

6. Find a running Java Process by executing ps -ef. Take note of PID.

7. Execute the following command to run Jolokia Agent by attaching it to the running Java Process. (username and password are mandatory for Jolokia 1.6 or later, Note we have downloaded version 1.7.1)

java -jar agent.jar --host <IP-Address> --port <1234> --user <username> --password <password> start <PID-of-running-java-process>

8. My actual command and output look like the below screenshot

9. Open the URL http://<IP-Address>:Port/jolokia/  and it will prompt for username/password to be entered. Enter the credentials that you used while starting the Jolokia agent. The output will look like the below screenshot.

10. Configure the Telegraf Jolokia Input Plugin First, create a file called `jmx.conf` in `/etc/telegraf/telegraf.d`. My jmx.conf looks like this, customize as per your needs.

[[inputs.jolokia2_agent]]
name_prefix = "jmx."
urls=["http://10.X.X.X:7XX9/jolokia/"]
username="jolokia"
password="jolokia"
[[inputs.jolokia2_agent.metric]] name = "OperatingSystem" mbean = "java.lang:type=OperatingSystem" paths = ["ProcessCpuLoad","SystemLoadAverage","SystemCpuLoad","OpenFileDescriptorCount","CommittedVirtualMemorySize","FreePhysicalMemorySize","FreeSwapSpaceSize","TotalPhysicalMemorySize","TotalSwapSpaceSize","MaxFileDescriptorCount","AvailableProcessors"]
[[inputs.jolokia2_agent.metric]] name = "jvm_runtime" mbean = "java.lang:type=Runtime" paths = ["Uptime", "StartTime"]
[[inputs.jolokia2_agent.metric]] name = "jvm_memory" mbean = "java.lang:type=Memory" paths = ["HeapMemoryUsage", "NonHeapMemoryUsage", "ObjectPendingFinalizationCount"]
[[inputs.jolokia2_agent.metric]] name = "jvm_garbage_collector" mbean = "java.lang:name=*,type=GarbageCollector" paths = ["CollectionTime", "CollectionCount"] tag_keys = ["name"]
[[inputs.jolokia2_agent.metric]] name = "jvm_memory_pool" mbean = "java.lang:name=*,type=MemoryPool" paths = ["Usage", "PeakUsage", "CollectionUsage"] tag_keys = ["name"] tag_prefix = "pool_"
[[inputs.jolokia2_agent.metric]] name = "jvm_classloading" mbean = "java.lang:type=ClassLoading" paths = ["LoadedClassCount", "UnloadedClassCount", "TotalLoadedClassCount"]
[[inputs.jolokia2_agent.metric]] name = "jvm_threading" mbean = "java.lang:type=Threading" paths = ["TotalStartedThreadCount", "PeakThreadCount", "CurrentThreadCpuTime", "ThreadCount", "DaemonThreadCount"]
[[inputs.jolokia2_agent.metric]] name = "SonarQubeAsyncExecution" mbean = "SonarQube:name=AsyncExecution" paths = ["LargestWorkerCount","WorkerCount","QueueSize"]
[[inputs.jolokia2_agent.metric]] name = "SonarQubeDatabase" mbean = "SonarQube:name=Database" paths = ["PoolRemoveAbandonedTimeoutSeconds","PoolActiveConnections","PoolInitialSize","PoolIdleConnections","PoolRemoveAbandoned","PoolMaxWaitMillis","PoolMaxIdleConnections","PoolMaxActiveConnections","MigrationStatus"]
[[inputs.jolokia2_agent.metric]] name = "SonarQube" mbean = "SonarQube:name=SonarQube" paths = ["Version","LogLevel","ServerId"]

11. Now restart the telegraf agent. 

systemctl restart telegraf

12. Once the SonarQube Server Metrics start flowing to Tanzu Observability , the JMX Integration gets a green tick mark on METRICS. This indicates that the streaming of metrics from SonarQube (Ubuntu Server) to Wavefront is successful. This is how it looks

13. Install the CONTENT : DASHBOARDS to view the metrics flowing in. This is how my JMX Dashboard for SonarQube looks like