Mqtt consumer telegraf plugin work with protobuf msg

system version

ubuntu 20.04
InfluxDB v2.6.1
Telegraf 1.25.0

I used to use json with mqtt consumer telegraf plugin and everything works fine.
Now I want to replace json with protobuf, but It seem like telegraf don’t push the data into DB
Here is my .proto file and Telegraf config.

syntax = 'proto3';
package flight_information_proto;

message GPS {
    optional float LAT = 1;
    optional float LON = 2;
    optional float ALT = 3;

message flight_information_message {
    GPS gps = 1;
    optional float heading = 2;
  data_format = "xpath_protobuf"
  xpath_protobuf_file = "flight_information.proto"
  xpath_protobuf_type = "flight_information_proto.flight_information_message"
  xpath_print_document = true

I don’t see any error messages

$telegraf --config
2023-02-07T09:19:21Z I! Starting Telegraf 1.25.0
2023-02-07T09:19:21Z I! Available plugins: 228 inputs, 9 aggregators, 26 processors, 21 parsers, 57 outputs, 2 secret-stores
2023-02-07T09:19:21Z I! Loaded inputs: mqtt_consumer
2023-02-07T09:19:21Z I! Loaded aggregators: 
2023-02-07T09:19:21Z I! Loaded processors: 
2023-02-07T09:19:21Z I! Loaded secretstores: 
2023-02-07T09:19:21Z I! Loaded outputs: influxdb_v2
2023-02-07T09:19:21Z I! Tags enabled: host=tony
2023-02-07T09:19:21Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"tony", Flush Interval:10s
2023-02-07T09:19:21Z I! [inputs.mqtt_consumer] Connected [tcp://]

There doesn’t seem to be any messages uploaded to DB.

Inaddtion, Telegraf is not able to read more than one type. what should I do if I have more than one type?

I would expect this to print out the messages that are received. Are you seeing anything? If not, it may indicate that no messages are received.

1 Like

I wondered if telegraf got the message.
So I changed the telegraf config back to json format

  data_format = "json"
  json_strict = true

It show the error msg.

This should mean that telegraf has received the message, right?

It does - @srebhan any guidance on debugging this one?

Could I provide you with any information so that you can assist me?

@Cordic45 yes it seems like Telegraf received messages. The issue is that sometimes the protobuf messages themselves are encapsulated into another protocol (often having a length field prepented to the protobuf). If you do not know the encapsulation protocol/format, you can try to run Telegraf with --debug which will output the raw data (containing with "raw data (hex):) so we can try to reverse the offset and use xpath_protobuf_skip_bytes