edgard / iperf3_exporter Goto Github PK
View Code? Open in Web Editor NEWSimple server that probes iPerf3 endpoints and exports results via HTTP for Prometheus consumption
License: Creative Commons Zero v1.0 Universal
Simple server that probes iPerf3 endpoints and exports results via HTTP for Prometheus consumption
License: Creative Commons Zero v1.0 Universal
Would it be possible to add the iperf retransmit / errors to prometheus as well? I see it in the metrics page but not my prometheus instance.
# HELP iperf3_exporter_errors_total Errors raised by the iperf3 exporter.
# TYPE iperf3_exporter_errors_total counter
iperf3_exporter_errors_total 10
# HELP iperf3_success Was the last iperf3 probe successful.
# TYPE iperf3_success gauge
iperf3_success 0
By default the web server from Go Lang's net/http
package does not set timeouts.
https://github.com/edgard/iperf3_exporter/blob/master/iperf3_exporter.go#L221
You can set a proper timeout by doing something like this ...
srv := &http.Server{
Addr: "0.0.0.0:8080",
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
}
log.Fatal(srv.ListenAndServe())
When collecting data from a server, the iperf3_received_bytes & iperf3_received_seconds are stored in prometheus but if the server is stopped or goes down (or connectivity issues) these metrics are no longer stored in prometheus, only the "e.success" metric is stored with a 0 value.
The problem with this behaviour is that it creates gaps with no measure at all. I believe it would be better to include the
iperf3_received_bytes, iperf3_received_seconds both with 0 value.
if err != nil {
ch <- prometheus.MustNewConstMetric(e.success, prometheus.GaugeValue, 0)
ch <- prometheus.MustNewConstMetric(e.receivedSeconds, prometheus.GaugeValue, 0) //iperf3_received_bytes = 0
ch <- prometheus.MustNewConstMetric(e.receivedBytes, prometheus.GaugeValue, 1)//iperf3_received_seconds = 1
iperfErrors.Inc()
log.Errorf("Failed to run iperf3: %s", err)
return
}
Check the image attached, in red the resulting measure if the iperf3_received_bytes, iperf3_received_seconds are always stored
I tried to set an duration of 60 seconds (thanks for the hint from earlier), but cannot get the timeout to go above 30 seconds. It looks like you have code to limit it to 30 seconds on line 193. Is there a reason for this? Thanks!
# HELP iperf3_success Was the last iperf3 probe successful.
# TYPE iperf3_success gauge
iperf3_success 0
ben@k8s-worker:~/Desktop/test$ sudo docker logs 198b3035030f
time="2024-05-11T13:28:03Z" level=info msg="Starting iperf3 exporter(version=0.1.3, branch=v0.1.3, revision=3ec09efe6175e6a8eab46e5c762288a922a29f5c)" source="iperf3_exporter.go:218"
time="2024-05-11T13:28:03Z" level=info msg="Build context(go=go1.13.8, user=\"ecastro\", date=\"2020-02-25T18:49:55Z\")" source="iperf3_exporter.go:219"
time="2024-05-11T13:28:03Z" level=info msg="Listening on :9579" source="iperf3_exporter.go:248"
time="2024-05-11T14:39:56Z" level=error msg="Failed to run iperf3: signal: killed" source="iperf3_exporter.go:117"
time="2024-05-11T14:43:47Z" level=error msg="Failed to run iperf3: signal: killed" source="iperf3_exporter.go:117"
time="2024-05-12T07:31:42Z" level=error msg="Failed to run iperf3: exit status 1" source="iperf3_exporter.go:117"
time="2024-05-12T07:31:45Z" level=error msg="Failed to run iperf3: exit status 1" source="iperf3_exporter.go:117"
ben@k8s-worker:~/Desktop/test$ sudo docker exec -it 198b3035030f sh
/ # iperf3_exporter --log.level=debug
INFO[0000] Starting iperf3 exporter(version=0.1.3, branch=v0.1.3, revision=3ec09efe6175e6a8eab46e5c762288a922a29f5c) source="iperf3_exporter.go:218"
INFO[0000] Build context(go=go1.13.8, user="ecastro", date="2020-02-25T18:49:55Z") source="iperf3_exporter.go:219"
INFO[0000] Listening on :9579 source="iperf3_exporter.go:248"
FATA[0000] listen tcp :9579: bind: address already in use source="iperf3_exporter.go:249"
/ #
No route to host when trying to scrap from prometheus.
Get http://192.168.1.1:9579/probe?target=192.168.1.2: dial tcp 192.168.1.1:9579: connect: no route to host
When trying to access directly fro browser it success.
http://192.168.1.1:9579/probe?target=192.168.1.2
192.168.1.1 Docker host / 192.168.6.2 iperf3 host
Hi Edgard,
I would like to know if there is a way to log directly the bitrate that is normally shown by iperf3 logs, instead of the bit transferred and the duration. Is it possible to include it easily in the code? Would appreciate some tips for that.
Thanks!
It would be nice to collect data not only for upload speed, but also for download speed (-R
iperf3 parameter)
Hi,
after running iperf3_exporter from time to time and randomly (without a specific pattern) got this error which tells the iperf3 is killed
do you have any idea?
I looked at the code (do not know Golang that well) and it looks like you have the ability to pass in var for iperf to run for different lengths; for example say I want to run each test for 60 seconds. I dont know if i'm missing how to pass it via CLI or Prometheus config or if its just a feature request. It would be very helpful if I could modify it with a parameter. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.