Solutions

LE-MQTT TO InfluxDBv2

5min
overview how to use the solution using docker here is an example to run le mqtt to influxdbv2 with docker docker run itd name le mqtt to influxdbv2 e influx host=http //influxdb oss 8086 e influx org=litmus e influx token=supersecuretoken e influx bucket=le mqtt to influxdbv2 e mqtt host=tcp\ //mqtt 1883 e mqtt topics=le mqtt to influxdbv2/ e mqtt qos=1 e mqtt persistent session=false e mqtt timeout=30s e mqtt client id=le mqtt to influxdbv2 oss test client e mqtt username=username e mqtt password=password e telegraf max undelivered messages=5000 e telegraf metric buffer limit=10000 e telegraf batch size=5000 e telegraf mqtt flush interval=5s e telegraf hc flush interval=3s e telegraf hc collect interval=3s e telegraf debug=true e le name=le 08 00 27 3b 0b 50 us docker pkg dev/litmus customer facing/litmus solutions dev/le mqtt to influxdbv2\ latest le mqtt to influxdbv2 docker image is available at https //us docker pkg dev/litmus customer facing/litmus solutions dev/le mqtt to influxdbv2\ latest requirements mqtt broker v3 1 1 influxdb v2 x if the subscribed data is not published by litmus edge instances, it must be a valid json string (or object) and have the same json schema used by litmus edge configuration options ⚠️ when using docker, the following environment variables must be set before running the container environment variables description sample value type mqtt host broker url for the mqtt server or cluster tcp\ //localhost 1883 string mqtt topics topics that will be subscribed to le mqtt to influxdbv2/# string mqtt qos qos policy for messages 1 integer mqtt client id the id to assign to the client when connecting to the broker le uniqueclientid string mqtt username the username to connect to the mqtt server admin string mqtt password the password to connect to the mqtt server admin string mqtt persistent session persistent session disables clearing of the client session on connection in order for this option to work you must also set mqtt client id to identify the client to receive messages that arrived while the client is offline, also set the qos option to 1 or 2 and don't forget to also set the qos when publishing true boolean mqtt timeout connection timeout for initial connection in seconds 30s string telegraf metric buffer limit maximum number of unwritten metrics increasing this value allows for longer periods of influxdb downtime without dropping metrics at the cost of higher maximum memory usage 10000 integer telegraf batch size le mqtt to influxdbv2 will send metrics to influxdb in batches of at most telegraf batch size metrics this controls the size of writes that le mqtt to influxdbv2 sends to influxdb 5000 integer telegraf max undelivered messages maximum messages to read from the broker that have not been written to influxdb for best throughput set based on the batch size telegraf batch size 5000 integer telegraf mqtt flush interval period is seconds between writes to influxdb from mqtt topics 5s string telegraf hc flush interval period is seconds between writes to influxdb from internal input (le mqtt to influxdbv2 statistics) 3s string telegraf hc collect interval period is seconds between each collect of le mqtt to influxdbv2 statistics 3s string telegraf debug log at debug level true boolean le name litmus edge friendly name (used to name/identify the measurement) le local vm string influx host the influxdb url string influx org organization is the name of the organization you wish to write to litmus string influx token token for authentication supersecuretoken string influx bucket destination bucket to write into le mqtt to influxdbv2 string how to use monitor le mqtt to influxdbv2 performance (optional) le mqtt to influxdbv2 also sends metrics about itself to influxdb such as the number of metrics gathered, added, written and dropped as well as the time spent in collecting and writing the metrics the following influxdb template contains a dashboard to visualize these metrics for each instance of le mqtt to influxdbv2 https //gist github com/amine amaach/0035b2959d77943578dd424783122df0/raw/59fb6f4fc4f7eacba82d504cbf11d99d70a0d1aa/le ingestors monitoring yml to install the template, go to settings, choose templates and enter the above url, then click the lookup templalte button under dashboards select le ingestors | performance monitoring dashboard