Having a stream input with Telegraf

Hi,

I have something writing data on serial port (/dev/serial0) every second.
I have a shell script able to read serial port line by line and convert data to telegraf/influxdb input format.

What do I do from now ? Can I use the “tail” input plugin with this ? how ? (I don’t want to write all datas in a file to be able to read them with the tail plugin, I’d like a real stream).

Extremely easy way is to install Node-Red and use the node-red-serialport and node-red-contrib-influxdb additions to wire it all up. No coding required.

Does it mean it wouldn’t be easy with Telegraf ? or not even possible ?

I’m on a constraint device where I’d like to install the least amount of tools possible, so Telegraf + InfluxDB for local storage is ok, but no more would be nice.

Btw, even if I used node-red, I’m not writing only to local InfluxDB, I’m also writing to some remote MQTT broker, I know it’s possible to do this with Node-RED but I know Telegraf has some good MQTT output plugin too, so if all was possible with Telegraf, it would be nice.

I suggest having your script send to a socket_listener input.

2 Likes

Ok, thanks !

I didn’t know much about sockets, but it looks totally feasible in pure shell.

So I can remember tomorrow how to do it :