telegraf: RabbitMQ Input Plugin v1.19.0 unmarshal errors

Relevant telegraf.conf:

[[inputs.rabbitmq]]
  ## Management Plugin url. (default: http://localhost:15672)
   url = "http://1.2.3.4:15672"
   username = "username"
   password = "password"

System info:

Windows Server 2019 Telegraf v1.19.0 RabbitMQ 3.8.14 Erlang 23.2.7

Steps to reproduce:

  1. Configure inputs.rabbitmq
  2. Run a test collection telegraf.exe --config “C:\Program Files\Telegraf\telegraf.conf” --test --input-filter rabbitmq --debug

Expected behavior:

Collection should complete without errors.

Actual behavior:

There are unmarshal errors within the collection

2021-06-16T16:17:01Z E! [inputs.rabbitmq] Error in plugin: json: cannot unmarshal object into Go value of type []rabbitmq.FederationLink 2021-06-16T16:17:01Z E! [inputs.rabbitmq] Error in plugin: json: cannot unmarshal number 0.0 into Go struct field Node.io_read_avg_time of type int64 2021-06-16T16:17:01Z E! [telegraf] Error running agent: input plugins recorded 2 errors

Additional info:

Telegraf v1.18.1 on the same system does not show the unmarshal errors.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (13 by maintainers)

Commits related to this issue

Most upvoted comments

@srebhan Looks good, I’ve set the metric_exclude and #9443 runs without collection errors. As best as I can compare given different collection results between runs the output looks similar and mem_total is now populated. Attached two samples from each version, prefixed at the start of the line. nodes_output.txt

The rest of the overview, exchange and queue output is the same.

@helenosheaa I think the problem is here as the code changed

-       json.NewDecoder(resp.Body).Decode(target)
-
-       return nil
+       return json.NewDecoder(resp.Body).Decode(target)

now checking the returned error, while before those errors went unnoticed.

Can anyone of you @aslgithub or @helenosheaa provide some sample data from /api/nodes and /api/federation-links so I can fix the underlying problem(s)?