Go to file
Marvin Preuss 3b4b62c0db
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Revert "fix: typo in log.colors flag"
This reverts commit ff1c039599.
2021-10-20 17:06:42 +02:00
build/package/docker build(dockerfile): sets environment variable for web listen string 2021-10-20 14:34:10 +02:00
init build: adds apk, deb, rpm packages with init scripts 2021-10-20 14:33:06 +02:00
test docs(prometheus): adds host label 2021-10-20 14:35:46 +02:00
tools first commit 2021-10-20 10:08:56 +02:00
vendor first commit 2021-10-20 10:08:56 +02:00
.drone.yml ci: docker login before running goreleaser 2021-10-20 14:41:27 +02:00
.gitignore meta: ignoring coverage 2021-10-20 14:32:02 +02:00
.goreleaser.yml build(goreleaser): ignore changelog entries with ^build 2021-10-20 16:51:21 +02:00
go.mod first commit 2021-10-20 10:08:56 +02:00
go.sum first commit 2021-10-20 10:08:56 +02:00
LICENSE.txt meta: adds license 2021-10-20 14:48:56 +02:00
main.go Revert "fix: typo in log.colors flag" 2021-10-20 17:06:42 +02:00
Makefile first commit 2021-10-20 10:08:56 +02:00
README.gif docs: first readme 2021-10-20 14:40:24 +02:00
README.md docs(readme): adds pkg.go.dev badge 2021-10-20 14:52:53 +02:00

IPERF3EXPORTER

Build Status Go Reference

A iperf3 speedtest exporter for prometheus

readme

It runs the iperf3 command as client. Once as server sends/client receives and once as client sends/server receives. It parses the JSON output and exports them as prometheus metrics.

Usage

Usage:
  iperf3exporter [flags]

Flags:
  -c, --config string      config file
  -h, --help               help for iperf3exporter
      --listen string      listen string (default "127.0.0.1:9119")
      --log-colors         colorful log output (default true)
      --log-json           JSON log output
      --process-metrics    exporter process metrics (default true)
      --time int           time in seconds to transmit for (default 5)
      --timeout duration   scraping timeout (default 1m0s)
  -v, --version            print version

Configuration

File

All flags can also be set through a config file. Here is an example:

[exporter] # everything related to the exporter itself
listen = "0.0.0.0:9119" # connection string for the webserver
timeout = "1m" # timeout of the iperf3 command to run
process_metrics = true # export go process metrics

[log]
json = true # enables json log output
colors = false # disable colors. this is only usable if log.json is set to false

[iperf3] # straight up iperf3 command line flag options
time = 10 # this sets the --time flag of iperf3 to 10

Environment variables

Its also possible to set this settings through environment variables. The environment prefix is IPERF3EXPORTER.

# this will disable colorful logs
IPERF3EXPORTER_LOG_COLORS=false /usr/local/bin/iperf3exporter

# this sets the iperf3 time flag to 10 seconds
IPERF3EXPORTER_IPERF3_TIME=10 /usr/local/bin/iperf3exporter

Example prometheus config

You can find a scrape config example here. This is the config that gets spun up while testing things for me locally. It replaces the targets with the real exporter adress and adds a label host that can be used to identify the scrape boxes and not just the iperf3 servers to test against.

Exposed metrics

name type
iperf3_download_sent_bits_per_second gauge
iperf3_download_sent_seconds gauge
iperf3_download_sent_bytes gauge
iperf3_download_received_bits_per_second gauge
iperf3_download_received_seconds gauge
iperf3_download_received_bytes gauge
iperf3_upload_sent_bits_per_second gauge
iperf3_upload_sent_seconds gauge
iperf3_upload_sent_bytes gauge
iperf3_upload_received_bits_per_second gauge
iperf3_upload_received_seconds gauge
iperf3_upload_received_bytes gauge