# HiveMQ community edition server metrics

**URL:** <https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84>\
**Category:** HiveMQ Community Edition\
**Created:** [September 24, 2019, 6:46pm UTC](https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84 "2019-09-24T18:46:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcp](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@mcp](https://community.hivemq.com/u/mcp)\
**Post date:** [September 24, 2019, 6:46pm UTC](https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84/1 "2019-09-24T18:46:02Z")

</div>

Just installed HiveMQ community edition. All went well…nice alternative to paho server.  
Thanks to HiveMQ for making this version open source. Had a few questions about  
metrics.

I installed the prometheus extension jar and had problems getting the extension to start up -  
missing servlet class in classpath. Found the note about correcting the gradle build file to  
include a dependency for this class and rebuilt the server jar. No problems in log file; but  
still no one listening on port 9399 (i.e. extension runs but is not active). Then I noticed  
an empty file in the extension directory - “DISABLE”. On a whim, I renamed it and viola,  
HiveMQ is up and promethius and grafana started showing server metrics! Just wanted  
to pass that along and would welcome any comments on alternate ways to get the  
prometheus extension up and running.

Here’s the reason I’m sending this note. I’ve loaded the grafana dashboard described in  
the HiveMQ document. Some of the metrics show up - and make sense - but, others are  
missing. The output of prometheus ("localhost:9399/metrics) shows, after removing lots  
of descriptive text, a set of name value pairs (e.g. “com\_hivemq\_messages\_incoming\_total\_count 123”). This list matches the code found in  
…/com/hivemq/metrics/MetricsHolder.java and HiveMQMetrics.java. But not all values are  
being updated.

I appears that some of the values in the MetricsRegistry are not being updated by the server code and, after  
looking at the json for the HiveMQ grafana dashboard, some of the value names formerly  
used as data sources for monitoring no longer appear in the MetricsRegistry - and do not  
appear in the server code base as well.

While some metrics (e.g. cluster info) don’t make any sense for the community edition,  
others, like ping counters and total bytes throughput, would be nice (i.e. “comforting”)  
to see when things appear to go wrong. Is this the result recent code refactoring in  
HiveMQ or, maybe, just didn’t make the list when creating the community edition code  
subset? I’d be glad to help re-insert metric code and contribute it back if it meets HiveMQ’s  
plans.

All in all, great job. When the time comes, I now have a migration path to a cloud  
environment.

Regards,  
mcp

---

<div class="post-metadata">

**Author:** ![sauroter](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sauroter/32/18_2.png) [@sauroter](https://community.hivemq.com/u/sauroter)\
**Post date:** [September 25, 2019, 7:16pm UTC](https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84/2 "2019-09-25T19:16:53Z")

</div>

Welcome @mcp,

nice to see your interest in the HiveMQ Community Edition and thank you for the warm words and praise.

The DISABLE file is generated if HiveMQ encounters an error while loading an extension or during extension execution, like when you have a unsatisfied class error. I would guess that it was still leftover from the earlier extension start. This behavior is documented in the HiveMQ documentation [https://www.hivemq.com/docs/latest/extensions/general.html#life-cycle](https://www.hivemq.com/docs/latest/extensions/general.html#life-cycle) but has not been added to the community edition wiki.

Right now only a view easily understood metrics are available in the community edition. These are:

- com.hivemq.messages.incoming.total.count
- com.hivemq.messages.outgoing.total.count
- com.hivemq.messages.incoming.connect.count
- com.hivemq.messages.incoming.publish.count
- com.hivemq.messages.outgoing.publish.count
- com.hivemq.messages.dropped.count
- com.hivemq.messages.retained.current
- com.hivemq.networking.bytes.read.total
- com.hivemq.networking.bytes.write.total
- com.hivemq.networking.connections.current
- com.hivemq.networking.connections-closed.total.count
- com.hivemq.subscriptions.overall.current
- com.hivemq.sessions.overall.current

At the moment we would like to keep it this way. You are correct in noticing that most other metrics do not make sense and others require a lot of knowledge in MQTT/broker interna. This may change in the future.

Have a great day  
Georg

---

<div class="post-metadata">

**Author:** ![mcp](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@mcp](https://community.hivemq.com/u/mcp)\
**Post date:** [September 25, 2019, 8:18pm UTC](https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84/3 "2019-09-25T20:18:54Z")

</div>

Georg,

Thanks for your note. “DISABLE” file now makes sense - your explanation exactly matches the sequence I went through. Feels good to understand how things work a bit better.

As for metrics, your list for the community edition looks pretty good. The only additions I might suggest is pingreq and pingresp. But, that’s clearly a matter of your priorities. I  
would note that the current contents of MetricsHolder.java isn’t an exact match for the  
list you provided. I’m guessing that the MetricsRegistry provides the list of key:value  
pairs that the prometheus outputs…at least that seems to be the case from scraping  
localhost:9399/metrics results.

I’d be glad to make the Metrics/ classes consistent with the above and see what happens.  
But, since there are currently no getXXXCounter() methods for some metrics in your list,  
I suspect that not all of them are being updated in the current server code. At least, I  
can’t find update accesses for some of these metrics by greping through /src… Not a  
criticism, just trying to add some value to the community edition.

Regards,  
Chuck

---

<div class="post-metadata">

**Author:** ![sauroter](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sauroter/32/18_2.png) [@sauroter](https://community.hivemq.com/u/sauroter)\
**Post date:** [September 26, 2019, 6:54am UTC](https://community.hivemq.com/t/hivemq-community-edition-server-metrics/84/4 "2019-09-26T06:54:45Z")

</div>

Hi Chuck,

you wont be able to find metrics like `com.hivemq.networking.bytes.read.total` by greping for `counter` because they are `gauges`. You can look in the package `com.hivemq.metrics[.handler]` for them.

I’m not completely sure what the `ping/pingresp` metric would enhance over the `connections.current` one. I feel like the former would only be a more difficult to understand one over the later.

Additionally such a metric could be very easily implemented through a custom extension once this [PR](https://github.com/hivemq/hivemq-community-edition/pull/74) is merged.

> Not a criticism, just trying to add some value to the community edition.

Don’t worry, your suggestions are completely welcome and we are very happy to consider the wishes of everybody interested in the project.

Have a nice day  
Georg
