Influx line protocol with MQTT Consumer Input Plugin from telegraf

Hi i am using MQTT Consumer Input Plugin to write publish my own metric data in that topic.In influx format.And the output is configured to influxdb.When i m publishing a single line data it is working,but it is not working when i try to push multiline data with \n in the end of the each line. ```
cpu,host=server01,region=uswest value=1 1434055562000000000 --this example is working

but when i try to do
cpu,host=server01,region=uswest value=1 1434055562000000000 \n cpu,host=server02,region=uswest value=3 1434055562000010000
publish these 2 data at the same time it is not working.

This is because influx line protocol is defined as a single line of input, not multiple lines of input. It was never designed to take multiple lines of input and split based on the \n character.

Best Regards,
dg

Thank you,is there any other way to pass mutliple metrics at the same timeeven if the format is JSON.Can u please help??

The http_listener plugin for Telegraf is capable of handling multi-line metrics.

dg

Just be aware that http_listener plugin has been deprecated in 1.9 in favor of influxdb_listener (same plugin, just a rename for clarity’s sake)

This should actually work in the mqtt_consumer, but only if you actually have a newline (ascii LF or 0A, not a literal \n):

cpu,host=server01,region=uswest value=1 1434055562000000000
cpu,host=server02,region=uswest value=3 1434055562000010000
1 Like