Skip to content

Report HiveMQ Metrics to AWS with the HiveMQ AWS CloudWatch Extension

by HiveMQ Team
4 min read

The HiveMQ team is pleased to announce the availability of the HiveMQ AWS CloudWatch Extension.

Monitoring a production MQTT broker system is very important to recognise problems in a timely manner and hopefully before these problems cause headaches for the production system. Amazon offers their own monitoring system AWS CloudWatch for applications running on the Amazon Web Services. HiveMQ is now able to integrate directly with AWS CloudWatch with the free off-the-shelf HiveMQ AWS CloudWatch Extension.

It is possible to send every HiveMQ metric to CloudWatch. Every metric which should be reported must be configured explicitly to reduce the costs, since CloudWatch can be expensive if you publish too much (unnecessary) data.

Once everything is set up the selected metrics are available in CloudWatch inside the instance’s region under the namespace ‘hivemq-metrics’.

Caution: AWS CloudWatch Costs

AWS CloudWatch metrics can be very expensive. So please make sure you really want to report the specified metrics.

At the time of writing the AWS prices are the following:

  • $0.30 per custom metric (for the first 10 000 metrics)

  • $0.01 per 1000 GetMetricStatistics, ListMetrics, or PutMetricData requests

Installation

  • Download the extension from the HiveMQ Website or our GitHub Releases Page.

  • Copy the content of the zip file to the extensions folder of your HiveMQ nodes.

  • Modify the extension-config.xml file for your needs.

Extension Configuration

The CloudWatch extension can be configured inside the ’extension-config.xml’ file.

The following properties are available:

Property Description
report-interval A value in minutes which sets the reporting interval (defaults to 1 minute)
api-timeout The api call and api attempt timeout in ms. (If not set defaults to AWS SDK default)
metric enabled="{true/false}" a metric name (from a list of metrics) which should be reported to CloudWatch

Example Configuration

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cloudwatch-extension-configuration>
    <report-interval>1</report-interval>
    <metrics>
        <metric>com.hivemq.messages.incoming.total.count</metric>
        <metric>com.hivemq.messages.outgoing.total.count</metric>
        <metric enabled="false">com.hivemq.messages.incoming.total.rate</metric>
    </metrics>
</cloudwatch-extension-configuration>

A list of all available metrics can be found on the HiveMQ Documentation here at HiveMQ Metrics

AWS CloudWatch Configuration

The extension needs permission to be able to publish metrics to AWS CloudWatch. Simply create an AWS IAM Role with a custom Policy that grants the CloudWatch:PutMetricData Permission and apply it to the HiveMQ instance.

Need help?

If you need assistance, we are happy to help. The best place to get in contact is our Support.

HiveMQ Team

The HiveMQ team loves writing about MQTT, Sparkplug, Industrial IoT, protocols, how to deploy our platform, and more. We focus on industries ranging from energy, to transportation and logistics, to automotive manufacturing. Our experts are here to help, contact us with any questions.

HiveMQ logo
Review HiveMQ on G2