Grafana integration


#1

Hi,
I’d like to point out that some of the links you provide in the tutorial for Grafana integration (https://www.bigclown.com/doc/integrations/grafana-for-visualization/) aren’t working anymore, specifically in the “Connect Mosquitto and InfluxDB” part.

Nonetheless, I’ve been thinking about the problem and came to the conclusion that the solution you provide is little too cumbersome (installing a Python script as a service with a InfluxDB as a dependency), since you can do the same thing trivially with Node-RED which anyone following your tutorials already has up and running.

Here is a simple flow you can use, all you have to do is change the database name in the HTTP node’s URL:

[{"id":"2e2be1c.86ee19e","type":"tab","label":"Air Quality","disabled":false,"info":""},{"id":"71ea288b.339e98","type":"mqtt in","z":"2e2be1c.86ee19e","name":"Air quality","topic":"node/kit-co2-monitor:0/#","qos":"2","broker":"c9395d0f.8a4a7","x":320,"y":420,"wires":[["d809390.f48a2c8","8a9e2e0b.b089c"]]},{"id":"d809390.f48a2c8","type":"function","z":"2e2be1c.86ee19e","name":"MQTT to InfluxDB","func":"var tokens = msg.topic.split(\"/\");\nvar measurement = tokens[tokens.length - 1]\n\nmsg.payload = measurement + \" value=\" + msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":420,"wires":[["5ebd3fed.e54a8","21703b2c.11257c"]]},{"id":"5ebd3fed.e54a8","type":"http request","z":"2e2be1c.86ee19e","name":"Post to InfluxDB","method":"POST","ret":"txt","url":"http://localhost:8086/write?db=air_quality","tls":"","x":800,"y":420,"wires":[["89a0644e.43217"]]},{"id":"89a0644e.43217","type":"debug","z":"2e2be1c.86ee19e","name":"","active":false,"console":"false","complete":"true","x":1010,"y":420,"wires":[]},{"id":"21703b2c.11257c","type":"debug","z":"2e2be1c.86ee19e","name":"","active":false,"console":"false","complete":"payload","x":790,"y":480,"wires":[]},{"id":"8a9e2e0b.b089c","type":"debug","z":"2e2be1c.86ee19e","name":"","active":false,"console":"false","complete":"true","x":510,"y":480,"wires":[]},{"id":"c9395d0f.8a4a7","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

#2

Hi,
thanks for info about dead links. We did some cleaning in Github repos. We’ll take a look at it.

The Grafana tutorial was created in a time, when we did not use Node-RED. But now we do, so this makes perfectly sense. Thank you for the flow, it is really simple so we will consider to create a new tutorial.


#3

I created issue in GitHub for this: https://github.com/bigclownlabs/bc-website/issues/14

Personally I would prefer the python script as I’d like to run it on my Turris Omnia. I’m afraid that running BigClown Bridge, Node-RED, InfluxDB and Grafana all at once would be too much resource-consuming.


#4

I agree. I am happy with my current setup consisting of bc-gateway, mosquitto, mqtt_to_influxdb, influxdb and grafana. I don’t have any use for Node RED at the moment.


#5

With the hint from @hubpav and @Karel the scripts can be found here https://github.com/blavka/bcp-monitor-in-docker + installation scripts (for RPi) here: https://github.com/bigclownlabs/bc-raspbian/tree/master/install.


#6

For anyone interested here are instructions on how to setup InfluxDB and Grafana (master version) LXC container on Turris Omnia: https://github.com/synaptiko/bigclown-influxdb-grafana-installation, there is also included script for bc-mqtt-to-influxdb and service file with few small adjustments.


#7

repo.bigclown.com doesn’t resolve anymore. Is the repository being retired?


#8

Yes, that is correct. We found out that we can live with Python Pip and that gives us more flexibility across the platforms. I am working on a documentation commit where repo.bigclown.com is not mentioned anywhere. Thanks.