HiveMQ InfluxDB Extension for Kubernetes

Hi Team,

I would like to implement InfluxDB extension on kubernetes environment to get metrics of hivemq on grafana dashboard and having issue to configure file.

Below is config file











I am not sure how to configure Tag:host parameter in above config file. because PODs will get scale up and scale down and IP addresses also get it changed.

Please help me on this.


In general, i would advise you to use Prometheus as your monitoring solution instead, as it is much easier to use on K8s due to exactly what you are experiencing: InfluxDB uses a push paradigm instead of pulling metrics from pods. I’ll post some references below.

Regardless: I would advise you to not specify a (what is presumably) podIP for the InfluxDB host. The most resilient approach here would be creating a Service (you can just use the ClusterIP type) that targets your InfluxDB deployment by label and specifying its DNS name as the host (similar to how the DNS discovery works, except that it routes directly to instances)

As for the tag fields: We haven’t tried tagging HiveMQ nodes when using influxDB on K8s yet, but i suppose the best approach to tag your resources for the influxDB time-series would be using downwardAPI:
You could expose the pod name (and if you wish, other fields like IP) as environment variables and then write a pre-entry script that replaces the tags in the file with sed before executing /opt/hivemq/bin/

Prometheus Operator for getting started with prometheus on K8s easily:

Some helpers if you choose to give prometheus-operator a try:

  • Use the Prometheus extension from our HiveMQ marketplace
  • You might need to patch your Prometheus custom resource’s “serviceMonitorSelector” field to allow it to find your ServiceMonitor (you can also set it to “{}” if i recall correctly to have it select any service monitor)
  • Here’s an example of a ServiceMonitor object you can use to have prometheus grab your metrics:
kind: ServiceMonitor
  name: hivemq-monitoring-sm
    - port: metrics
      your-label: value

Note that:

  • your-label: value must be replaced by some label the monitor can select your HiveMQ pods by (all HiveMQ pods must have this label)
  • your pod specification must contain the named port metrics that forwards to the metrics endpoint port (9399 by default)
  • set metric_path=/ in of the prometheus extension to allow Prometheus to more easily pick up the path where metrics can be scraped.
1 Like