Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

\uD83D\uDCD8 Pre-requisites

  1. Helm version v3+

  2. Running Kubernetes cluster version 1.18.0 or higher

  3. kubectl lastest version

\uD83D\uDCD8 Instructions

  1. Configure 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. kubectl get pods
      2. Also, check the agent’s log’s 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. hivemq:
          image: hivemq/hivemq4:k8s-4.7.5
          imagePullPolicy: Always
          cpu: 8
          memory: 8Gi
          nodeCount: "3"
        
        
          podAnnotations:
            ad.datadoghq.com/hivemq.check_names: '[\"hivemq\"]'
            ad.datadoghq.com/hivemq.init_configs: '[{\"is_jmx\": true, \"collect_default_metrics\": true}]'
            ad.datadoghq.com/hivemq.instances: '[{\"host\": \"%%host%%\",\"port\":\"9010\"}]'
            ad.datadoghq.com/hivemq.logs: '[{\"source\":\"hivemq\",\"service\":\"hivemq-hivemq-1778-mqtt\"}]'
          
          ports:
            - name: "mqtt"
              port: 1883
              expose: true
              patch:
               - '[{"op":"add","path":"/spec/type","value":"LoadBalancer"}]'
            - name: "cc"
              port: 8080
              expose: true
              patch:
                - '[{"op":"add","path":"/spec/sessionAffinity","value":"ClientIP"}]'
            
        operator:
          admissionWebhooks:
            # Enable the admission hook
            enabled: false
        
        monitoring:
          enabled: false
          dedicated: false
        
        
    2. Install hivemq using the following command

      1. helm upgrade --install -f hivemq-values.yaml <release name> hivemq/hivemq-operator
    3. verify installation

      1. kubectl get pods
    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 its data.
      Type hivemq in the search box and you should be able to see the list of available metrics.

    5. a

  3. Uninstall DataDog and HiveMQ

    1. helm list
      helm uninstall <datadog release name>
      helm uninstall <hivemq release name>
      kubectl delete ns <namespce>

  • No labels