...
Request from the HiveMQ Support team to provide the HiveMQ
grafana-metrics-exporter
tool. The tool is provided as a JAR file namedhivemq-metrics-exporter.jar
Run the exporter.
You can run the exporter with (Java 11+)
Code Block language bash java -jar hivemq-metrics-exporter.jar <options>
You can run a quick test if the parameters are correct by adding the
--test
param, then only the first metric is exported. Debug output can be enabled with-v
Exporting from Grafana
Find the Grafana Datasource Id.
To export the metrics from a Grafana Datasource first find the Datasource Id. To find the ID for the desired Grafana Datasource, first, log in to Grafana and next go to Menu→Configuration→Data Sources* and click on the desired Datasource, then the ID is part of the URLExample URL: https://my.grafana-url.com/datasources/edit/3/.
In the Example URL, the ID for the Datasource is
3
.
*If you cannot reach the Menu→Configuration→Data Sources, it indicates that you do not have necessary access rights to the Grafana. In this case, you need to contact the admin of Grafana and get the necessary access rights.Run the exporter.You can run the exporter with (Java 11+)
Code Block java -jar hivemq-metrics-language bash exporter
.jar <options>You can run a quick test if the parameters are correct by adding the
--test
param, then only the first metric is exported. Debug output can be enabled with-v
A full command looks should look like this:
Code Block | ||
---|---|---|
| ||
java -jar hivemq-metrics-exporter.jar \
--url "https://my.grafana-url.com/grafana" \
-u "myusername" \
-p "mypassword" \
-ds 1 \
-f "tag1=\"mytagvalue1\",tag2=\"mytagvalue2\"" \
--from "2021-08-01T10:00:00Z" \
--to "2021-08-01T19:00:00Z" \
--step 15s |
The result is a ZIP file that contains a JSON for each HiveMQ metric.
Exporting metrics from Prometheus
To export directly from Prometheus use the option “--direct
“.
A full command looks like this:
Code Block | ||
---|---|---|
| ||
java -jar hivemq-metrics-exporter.jar \ --url "https://my.prometheus-url.com:port" \ -u "myusername" \ -p "mypassword" \ --direct \ -f "tag1=\"mytagvalue1\",tag2=\"mytagvalue2\"" \ --from "2021-08-01T10:00:00Z" \ --to "2021-08-01T19:00:00Z" \ --step 15s |
...