Inut.exec multiple data submission


I want to submit multiple lines of data into influxdb via telegraf agent. I generate data out of bash script. Here is how it looks.

myhost=hostname1 used=10.00
myhost=hostname2 used=15.00
myhost=hostname3 used=18.00

Every time I run my script it generates output like this for multiple hosts but different used values.

I use input.exec plugin in telegraf to run the bash script and telegraf config block looks like this.

commands = ["/opt/"]
name_override = “mycustom_name”
timeout = “60s”
data_format = “influx”

But what happens is that only the last row of the output is inserted into influxDB and myhost values are not either being inserted so the output from InluxDB looks like this

select * from mycustom_name;

1553849707000000000 hostname3 true 25.01
1553849764000000000 hostname3 true 58.01
1553849946000000000 hostname3 true 55.01
1553850002000000000 hostname3 true 75.01

Hi there!

Welcome to our community.

Your output isn’t quite in correct line protocol format. You can read more on the docs.

You’re missing a measurement name:

measurement,tag_set field_set timestamp

You’ll need to modify your bash script to output:

measurement_name,myhost=hostname1 used=10.00


Said and done. And it works flawlessly. Yipiii!!! Thanks rawkode for a quick reply.

1 Like