Webhook for Telegraf/Influx

I have a project I am working on where I am using a photon to collect about a dozen data point and I want to log them to an InfluxDB. Currently the data is collected fine. I had been send the data directly to an InfluxDB over TCP using the built in TCPClient. This proved to be problematic. My photons would lock up and blink green anywhere between 15 minutes and 2 hours later. I added an SD card to log the data and removed the writing to the database and they run fine. I then added a Particle.publish command and they run fine. This has lead me to look into creating a webhoook to push this data to the InfluxDB.

At this point I am stuck. What is the best way to push this data. Can I take the data string that is formatted as JSON and deserialize it and push it to the InfluxDB as a POST? I have setup Telegraf with the particle plugin as described here. I am still not sure how to go about taking my data and sending it to telegraf.

Does anyone have advice on how to make this work?

I have four Photons sending data to an InfluxDB via UDP, one of them every three seconds, the others about every 10 minutes. Everything works for several weeks without any problems so far. I have also used TCP without any problems. So maybe there is something wrong without your code, server or internet connection.

My approach is to have a python script receive events from particle via server side events and then write influxDB with the influxDB module.

Thanks for the idea @mrOmatic. I will give something like this a shot. Seems like an easy way to receive the JSON and do with it what I need.

1 Like