# Input plugin for iPerf3 with exit status errors

**URL:** <https://community.influxdata.com/t/input-plugin-for-iperf3-with-exit-status-errors/18793>\
**Category:** Telegraf\
**Tags:** exec\
**Created:** [March 9, 2021, 10:08pm UTC](https://community.influxdata.com/t/input-plugin-for-iperf3-with-exit-status-errors/18793 "2021-03-09T22:08:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debi](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/debi/32/6871_2.png) [@Debi](https://community.influxdata.com/u/Debi)\
**Post date:** [March 9, 2021, 10:08pm UTC](https://community.influxdata.com/t/input-plugin-for-iperf3-with-exit-status-errors/18793/1 "2021-03-09T22:08:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [March 10, 2021, 11:58am UTC](https://community.influxdata.com/t/input-plugin-for-iperf3-with-exit-status-errors/18793/2 "2021-03-10T11:58:10Z")

</div>

> [@Debi](#):
>
> are these errors normal?

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

---

<div class="post-metadata">

**Author:** ![bfuerst](https://avatars.discourse-cdn.com/v4/letter/b/34f0e0/32.png) [@bfuerst](https://community.influxdata.com/u/bfuerst)\
**Post date:** [January 15, 2022, 3:02pm UTC](https://community.influxdata.com/t/input-plugin-for-iperf3-with-exit-status-errors/18793/3 "2022-01-15T15:02:23Z")

</div>

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:

```auto
#!/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:

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

```
