Commit b3f6da24 authored by Vitaly Lipatov's avatar Vitaly Lipatov

check_system/check-blocked: use iperf3 for bandwidth, add gre.vdska

Switch bandwidth source from net.bytes_recv (current traffic) to iperf3.recv_bps (tunnel throughput). Add gre.vdska gateway (91.232.225.127). Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 6db4ffa5
......@@ -196,10 +196,9 @@ setInterval(refresh, 5 * 60 * 1000);
def query_bandwidth():
"""Query average bandwidth (bit/s) per gateway from InfluxDB over last 30 min."""
q = ("SELECT non_negative_derivative(mean(bytes_recv),1s)*8"
" FROM net WHERE time > now() - 30m"
" GROUP BY time(30m), gateway")
"""Query average iperf3 bandwidth (bit/s) per gateway from InfluxDB over last 30 min."""
q = ("SELECT mean(recv_bps) FROM iperf3"
" WHERE time > now() - 30m GROUP BY gateway")
params = urllib.parse.urlencode({"db": INFLUXDB_DB, "q": q})
url = "%s/query?%s" % (INFLUXDB_URL, params)
try:
......@@ -210,12 +209,9 @@ def query_bandwidth():
result = {}
for series in data.get("results", [{}])[0].get("series", []):
gw = series.get("tags", {}).get("gateway", "")
values = series.get("values", [])
if values:
# Take the last 30-min window value
bps = values[-1][1]
if bps is not None:
result[gw] = bps
val = series.get("values", [[None, None]])[0][1]
if val is not None:
result[gw] = val
return result
......
......@@ -24,6 +24,7 @@ dgw socks5h://91.232.225.12:1080
igw socks5h://91.232.225.13:1080
gre.hetzner socks5h://91.232.225.122:1080
ikev2.hetzner socks5h://91.232.225.120:1080
gre.vdska socks5h://91.232.225.127:1080
gre.beget.ogw socks5h://91.232.225.124:1080
ikev2.beget.ogw socks5h://91.232.225.130:1080
"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment