Expose HiveMQ JMX metrics for DataDog in Kubernetes

This artical explains how to expose HiveMQ JMX metrics in DataDog using Kubernetes

 Pre-requisites

  1. Helm version v3+

  2. Running Kubernetes cluster version 1.18.0 or higher

  3. kubectl lastest version

 Instructions

  1. Configure the DataDog agent using the Helm chart

    1. Add Datadog helm repository

      1. helm repo add datadog https://helm.datadoghq.com helm repo update
    2. Create datadog-values.yaml. For full values check here.
      Please refer to following the example of datadog-values.yaml

      1. logLevel: DEBUG targetSystem: "linux" datadog: apiKey: <your api key from your account> #Logs configurations logs: enabled: true containerCollectAll: true containerCollectUsingFiles: true #Plesse configure this setting based on your region site: datadoghq.eu tags: [] # datadog.kubelet.tlsVerify should be `false` on kind and minikube # to establish communication with the kubelet kubelet: tlsVerify: false #Following settings are required to collect the Kubernetes events with the Cluster Agent collectEvents: true clusterAgent: rbac: create: true # setting to read JMX metrics from HiveMQ agents: image: tagSuffix: "jmx"
    3. install Datadog agent using Helm

      1. kubectl create ns <namespace> helm install -f datadog-values.yaml <release name> datadog/datadog
    4. Verify installation and check the agent pod’s status

      1. Also, check the agent’s logs to confirm.

  2. Install HiveMQ using Operator

    1. Configure hivemq-values.yaml based on your requirement and then add podAnnotations for Datadog to auto-discover HiveMQ metrics and logs. Check here for details.
      Please find below a minimalist config example of hivemq-values.yaml

      1. If you would like to add more metrics to available HiveMQ metrics, please refer the following example.

    2. Install HiveMQ using the following command

    3. verify installation

    4. Login to your Datadog account and click “Metrics” =>” Explorer” from the left navigation links. You will be redirected to the “Graph your data” page. By default, you will see “system.cpu.user“ metrics and their data.
      Type "hivemq" in the search box and you should be able to see the list of available metrics.

    5. Create HiveMQ dashboard:

      1. Click the “New Dashboard” link from the left navigation links.

      2. enter the name and select the “New Screenboard” button.

      3. Click the “Gear” icon from the top right corner and click the “Import Dashboard JSON” link

      4. Import the attached HiveMq dashboard JSON and done

      5. Check the HiveMQ dashboard to view HiveMQ Metrics.

  3. Uninstall DataDog and HiveMQ