Input plugin for iPerf3 with exit status errors

Hi there,

I am currently getting these errors:
2021-03-06T12:29:01Z E! [inputs.exec] Error in plugin: exec: exit status 1 for command ‘iperf3 -c 201.1.1.4 -u --get-server-output --json’:
2021-03-06T12:29:01Z E! [inputs.exec] Error in plugin: exec: exit status 1 for command ‘iperf3 -c 201.1.1.4 -i 0.5 --json’:
2021-03-06T12:29:01Z E! [inputs.exec] Error in plugin: exec: exit status 1 for command ‘iperf3 -c 201.1.1.4 -i 0.5 --json’:
2021-03-06T12:29:01Z E! [inputs.exec] Error in plugin: exec: exit status 1 for command ‘iperf3 -c 201.1.1.4 -i 0.5 --json’:

are these errors normal? as the server is displaying results and have connection to the client.

Please help. Thank you in advanced!

Best
Debi

No, the call to iperf3 returns an error.
I suspect your iperf3 call is either incorrect or the ip address is unreachable.

The inputs.exec plugin may have problems with multiline JSON output. Just pipe the iperf3 output into jq -c to transform it to a one line JSON output.

BTW: I want to measure upload and download bandwidth one after the other so I created a shell script:

#!/bin/bash
#
# Run iperf3 and extract end.sum_received.bits_per_second by using jq.
# --omit 5: ignore the first 5 measurements to let the connection warm up.
#
# See
#  - https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
#  - https://github.com/influxdata/telegraf/blob/master/plugins/inputs/exec/README.md
#

SERVER=your-iperf3-server.tld

download=$(/usr/bin/iperf3 --client ${SERVER} --json --reverse --omit 5 \
	| /usr/bin/jq .end.sum_received.bits_per_second)

upload=$(/usr/bin/iperf3 --client ${SERVER} --json --omit 5 \
	| /usr/bin/jq .end.sum_received.bits_per_second)

echo "{\"download\":$download,\"upload\":$upload}"

Which is used in Telegraf like this:

[[inputs.exec]]
  commands=["/path/to/script"]
  interval = "30m"
  timeout = "10m"
  data_format = "json"
  name_override = "iperf"