Hello, I’m trying to setup a telegraf instance to query a piece of equipment called Mastertroinc that performs automated water testing for aquariums. I was able to figure out part of their API and the call that I need to perform is a POST request with a plain JSON body.
The equipment keeps returning an error 500 when I send the POST from telegraf but works OK when I do that with my browser using a basic HTML form.
After comparing the traffic using wireshark, the only difference I see is that the telegraf POST does not include the “Content-Length” header, even if I hardcode the value and add it to the headers parameter in the telegraf.conf file.
Does anyone know how to enable the “Content-Length” header or at least prevent telegraf from ignoring it when I hardcode it in the conf file?
Thank you very much!
(if the body contains anything else than JSON, the equipment returns an error 500).
I setup my telegraf.conf to perform a post and added the required JSON to the body parameter but when I execute it, the response I see in the log is
[inputs.http] Error in plugin: [url=http://192.168.1.69/api/action_list]: received status code 500 (Internal Server Error), expected any value out of [200] stdout
I’m not sure if the POST request is being sent with no body or if my JSON code in the body is misconstructed.
Does anyone know how can I see the POST query that telegraf is sending or any other way to debug this issue?
Thanks in advance.
For reference, here are the relevant parameters in my telegraf.conf file
[[inputs.http]]
urls = [“http://192.168.1.69/api/action_list”]
method = “POST”
body = “{“action”:“HISTORY”,“data”:{“range”:“1440”},“type”:“read”}”