Webhook to AWS/Telegraf

Hi folks,

I’m working on running Telegraf on AWS, then using webhooks to talk to it. I’m really hoping to stay with the Particle.publish() system, rather than adding on MQTT or something along those lines, primarily due to flash space issues. Working from a suggestion from @sja, I’ve gone through the following steps:

  1. Registered a domain through AWS Route53
  2. Created an instance of the Amazon Linux AMI
  3. Installed and config’d InfluxDB and Telegraf on the VM.
  4. Created a webhook pointing to https://mydomain.com/particle
  5. Created a Network ELB and pointed the domain alias to the ELB.

When I try to test the webhook through the Particle console, I’m getting a ‘socket hang up’ error. I strongly suspect the issue is in my ELB Listener and Target configs, but I’m not certain exactly how they need to be set up. My thoughts are as follows:

  1. Telegraf uses port 1619
  2. HTTPS uses 443
  3. So I should be listening on 443 and forwarding that to my vm target on 1619?

I’m definitely in over my head here, but it would be incredibly helpful if I could get this up and running. Does anyone have any thoughts?

Thanks,
Peter

Have a look at the Amazon API Gateway product.

You may have better luck going: Particle Device > Particle Webhook > AWS API Gateway > Lambda

Google some Lambda options on how to pass info into Telegraf.
This may work > https://www.npmjs.com/package/telegraf-aws

Might also be worth reaching out on the Telegraf forums or AWS forums as it sounds like an issue there :slight_smile:

1 Like

Thanks very much, I’ll check it out.

Hmm, turns out that’s the wrong Telegraf, turns out there’s that one, an add-on for a messaging service, and then there’s InfluxData Telegraf, the one I need. Which apparently won’t work in a Lambda. Ah well, back to poking at it…

How are you testing the webhook? I struggled with this and posted my specific issue / solution on another thread.

I am running my solution on DigitalOcean but otherwise it is just a cloud VM with Telegraf / InfluxDB so it should work the same. A closer match to my solution would be a simple VM on AWS Lightsail with the Telegraf port exposed.

I would suggest breaking down the issue like this:

  1. Make sure the Telegraf webhook input is working by testing with curl or some other tool. You should either see data show up in InfluxDB or some related errors in the Telegraf logs (or no response indicating Telegraf is not reachable - could be an AWS routing issue).
  2. Instead of using the Particle Webhook Console "Test" feature, publish test data from a Particle device with an appropriately formatted JSON payload. The test feature will connect to Telegraf but produce an error because Telegraf won't be able to parse the test data.