# MQTT - using the $SYS topic to get MQTT server information

**URL:** https://discourse.nodered.org/t/mqtt-using-the-sys-topic-to-get-mqtt-server-information/61324
**Category:** General
**Created:** [15 April 2022 09:22 UTC](https://discourse.nodered.org/t/mqtt-using-the-sys-topic-to-get-mqtt-server-information/61324 "2022-04-15T09:22:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [15 April 2022 09:22 UTC](https://discourse.nodered.org/t/mqtt-using-the-sys-topic-to-get-mqtt-server-information/61324/1 "2022-04-15T09:22:54Z")

</div>

Just stumbled upon a flow published in [Steves internet guide](http://www.steves-internet-guide.com/understanding-mqtt-topics/) that displays information in a node-RED dashboard about your Mosquitto MQTT server.

 ![mossy](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b354a466151c2361f1f1b50c2b46e99b81f761d.jpeg)

The screenprint doesn't capture the full screen, but it also shows comprehensive information about retained messages, subscriptions etc.  
You may find this of interest...

```auto
[{"id":"feef7174.a35ff","type":"tab","label":"Mosquitto Broker $SYS Monitor","disabled":false,"info":""},{"id":"fce3cf67.80e7c","type":"mqtt in","z":"feef7174.a35ff","name":"","topic":"$SYS/#","qos":"0","datatype":"auto","broker":"9a3ac674.8ced9","x":110,"y":100,"wires":[["6a8d7767.9a4bf"]]},{"id":"541c48c9.3afaf8","type":"template","z":"feef7174.a35ff","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<table class=\"table\">\n <tr>\n\n <th>TOPIC</th>\n <th>VALUE</th>\n \n </tr>\n {{#payload}}\n <tr>\n <td>{{topic}}</td> \n <td>{{payload}}</td>\n\n\n\n </tr>\n{{/payload}}\n\n \n</table>","output":"str","x":360,"y":260,"wires":[["4fe2160a.b77708"]]},{"id":"ba8eee5.873479","type":"debug","z":"feef7174.a35ff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":430,"y":80,"wires":[]},{"id":"6a8d7767.9a4bf","type":"function","z":"feef7174.a35ff","name":"","func":"var topics=context.get('topics') || {};\nvar temp=context.get('temp') || [];\nvar payload=msg.payload;\nvar topic=msg.topic\nif (topic==\"timer\")\n{\nvar keys=Object.keys(topics)\nvar temp=[];\nfor(var i=0;i<keys.length;i++)\n{\n \n var data={\"topic\":keys[i],\"payload\":topics[keys[i]]}\n temp.push(data); \n}\nmsg.payload=temp;\ntemp=[];\ncontext.set(\"temp\",temp);//reset\n//if ()\nreturn msg;\n}\nelse\n{\n topics[topic]=payload\n var data={\"topic\":msg.topic,\"payload\":msg.payload}\n temp.push(data);\n context.set(\"topics\",topics);\n}","outputs":1,"noerr":0,"x":310,"y":160,"wires":[["541c48c9.3afaf8","ba8eee5.873479"]]},{"id":"4fe2160a.b77708","type":"ui_template","z":"feef7174.a35ff","group":"5533243a.0edaa4","name":"","order":6,"width":0,"height":0,"format":"\n<style>\n\n.headline\n{\n font-size:28px; \n font-weight: bold;\n \n}\n\n.table\n{\n \n width:500px; \n}\n.main\n{\n height:650px;\n width:600px;\n //background:#ffffc6;\n//border:1px solid black;\n}\n.table th,td\n{\nborder:1px solid black;\n}\n.table th\n{\n background: yellow;\n}\n</style>\n\n<div class=\"main\" ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":300,"y":500,"wires":[[]]},{"id":"4ef48789.b2e9d8","type":"inject","z":"feef7174.a35ff","name":"","topic":"timer","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["6a8d7767.9a4bf"]]},{"id":"9a3ac674.8ced9","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.21","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"120","cleansession":true,"birthTopic":"sensors/connected/test-client","birthQos":"0","birthRetain":"true","birthPayload":"1","closeTopic":"","closePayload":"","willTopic":"sensors/connected/test-client","willQos":"0","willRetain":"true","willPayload":"0"},{"id":"5533243a.0edaa4","type":"ui_group","z":"","name":"Mosquitto","tab":"75c10258.8ebf24","disp":true,"width":"12","collapse":false},{"id":"75c10258.8ebf24","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":19,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [15 April 2022 10:32 UTC](https://discourse.nodered.org/t/mqtt-using-the-sys-topic-to-get-mqtt-server-information/61324/2 "2022-04-15T10:32:59Z")

</div>

😀 Welcome to MQTT Paul 🤣 Sorry, couldn't resist.

Just to note that not all brokers turn that on by default but Mosquitto does. Also, `$sys` won't generally show up if you subscribe to `#`, you generally have to subscribe to it explicitly.

It does indeed though show some very useful info.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [14 June 2022 10:33 UTC](https://discourse.nodered.org/t/mqtt-using-the-sys-topic-to-get-mqtt-server-information/61324/3 "2022-06-14T10:33:11Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
