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 Prometheus metrics in DataDog using the HiveMQ operator

\uD83D\uDCD8 Pre-requisites

  1. Helm version v3+

  2. Running Kubernetes cluster version 1.18.0 or higher

  3. kubectl latest version

\uD83D\uDCD8 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: <api key>
          #Logs configurations
          logs:
            enabled: true
            containerCollectAll: true
            containerCollectUsingFiles: true
          
          #Plesse configure this setting based on your region
          site: datadoghq.eu
          
          # datadog.kubelet.tlsVerify should be `false` on kind and minikube
          # to establish communication with the kubelet
          kubelet:
            tlsVerify: false
          
        clusterAgent:
          replicas: 2
          createPodDisruptionBudget: true
    3. install Datadog agent using Helm

      1. helm install -f datadog-values.yaml <release name> datadog/datadog -n <namespace>
    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. The HiveMQ Kubernetes Operator provides seamless integration with the Prometheus Operator. Use the monitoring field to enable Prometheus and an associated Grafana dashboard. Metrics are exposed on port 9399.

    2. Configure hivemq-values.yaml based on your requirement and then add podAnnotations for Datadog to auto-discover HiveMQ metrics. Check here for more details and configurations.

      Please find below a minimalist config example of hivemq-values.yaml

      1. hivemq:
          image: hivemq/hivemq4:k8s-4.9.0
          imagePullPolicy: Always
          cpu: 8
          memory: 8Gi
          nodeCount: "2"
        
          podAnnotations:
                ad.datadoghq.com/hivemq.check_names: '[\"openmetrics\"]'
                ad.datadoghq.com/hivemq.init_configs: '[{}]'
                ad.datadoghq.com/hivemq.instances: |
                  [
                    {
                      \"openmetrics_endpoint\": \"http://%%host%%:9399/metrics\",
                      \"max_returned_metrics\": 10000,
                      \"metrics\": [\".*\"]
                    }
                  ]
          ports:
            - name: "mqtt"
              port: 1883
              expose: true
              patch:
                - '[{"op":"add","path":"/spec/selector/hivemq.com~1node-offline","value":"false"},{"op":"add","path":"/metadata/annotations","value":{"service.spec.externalTrafficPolicy":"Local"}}]'
            - name: "cc"
              port: 8080
              expose: true
              patch:
                - '[{"op":"add","path":"/spec/sessionAffinity","value":"ClientIP"}]'
            
        monitoring:
          enabled: true
          dedicated: false
        
    3. Install hivemq using the following command

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

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

  • No labels