Report HiveMQ metrics to AWS with the HiveMQ AWS CloudWatch Extension

Report HiveMQ metrics to AWS with the HiveMQ AWS CloudWatch Extension

author portrait

Written by The HiveMQ Team

Category: HiveMQ AWS Third Party

Published: August 26, 2021


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. You can find the full AWS pricing here.

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

1
2
3
4
5
6
7
8
9
<?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.

author HiveMQ Team

About The HiveMQ Team

We love writing about MQTT, IoT protocols and architecture in general. Our experts are here to help, so reach out to us if we can help!
mail icon Contact us

newer posts What is New in HiveMQ 4.7?
HiveMQ Cloud now grows with your needs older posts