I use a Node MCU (arduino-like device) to collect some measurements and I send them to Telegraf and then to influxDB and finally plot them in Grafana. It works fine. What I’m trying to do is to use the
net_response input plugin in Telegraf via UDP and send a dummy message to the MCU and measure the response time. The MCU is programmed to listen and reply to UDP messages with an “ACK” message.
In the Telegraf side the configuration looks like this:
[[inputs.net_response]] protocol = "udp" address = "192.168.178.28:4210" timeout = "1s" read_timeout = "1s" send = "THIS IS TELEGRAF!" expect = "ACK" fielddrop = ["result_type", "string_found"] [[inputs.socket_listener]] service_address = "udp://:1891"
where 192.168.178.28 is the IP of the MCU and 4210 is the UDP port that the MCU listens to. Telegraf sends out the message “THIS IS TELEGRAF!” and I can see it coming in the serial monitor for the MCU. The MCU replies with an “ACK” (I’ve tested that it reaches my PC where Telegraf runs via netcat) and replies to port 1891 where Telegraf listens to. However I get only the error_responce code in influxDB, so I suspect that the “ACK” message is not parsed correctly by Telegraf. When checking the telegraf.service I get
2020-05-17T11:06:38Z W! [agent] [inputs.net_response] did not complete within its interval
2020-05-17T11:06:42Z E! [inputs.socket_listener] Unable to parse incoming packet: invalid character 'A' looking for beginning of value
Is there something wrong with the setup or perhaps with the encoding of the ACK message?