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); ...@@ -196,10 +196,9 @@ setInterval(refresh, 5 * 60 * 1000);
def query_bandwidth(): def query_bandwidth():
"""Query average bandwidth (bit/s) per gateway from InfluxDB over last 30 min.""" """Query average iperf3 bandwidth (bit/s) per gateway from InfluxDB over last 30 min."""
q = ("SELECT non_negative_derivative(mean(bytes_recv),1s)*8" q = ("SELECT mean(recv_bps) FROM iperf3"
" FROM net WHERE time > now() - 30m" " WHERE time > now() - 30m GROUP BY gateway")
" GROUP BY time(30m), gateway")
params = urllib.parse.urlencode({"db": INFLUXDB_DB, "q": q}) params = urllib.parse.urlencode({"db": INFLUXDB_DB, "q": q})
url = "%s/query?%s" % (INFLUXDB_URL, params) url = "%s/query?%s" % (INFLUXDB_URL, params)
try: try:
...@@ -210,12 +209,9 @@ def query_bandwidth(): ...@@ -210,12 +209,9 @@ def query_bandwidth():
result = {} result = {}
for series in data.get("results", [{}])[0].get("series", []): for series in data.get("results", [{}])[0].get("series", []):
gw = series.get("tags", {}).get("gateway", "") gw = series.get("tags", {}).get("gateway", "")
values = series.get("values", []) val = series.get("values", [[None, None]])[0][1]
if values: if val is not None:
# Take the last 30-min window value result[gw] = val
bps = values[-1][1]
if bps is not None:
result[gw] = bps
return result return result
......
...@@ -24,6 +24,7 @@ dgw socks5h://91.232.225.12:1080 ...@@ -24,6 +24,7 @@ dgw socks5h://91.232.225.12:1080
igw socks5h://91.232.225.13:1080 igw socks5h://91.232.225.13:1080
gre.hetzner socks5h://91.232.225.122:1080 gre.hetzner socks5h://91.232.225.122:1080
ikev2.hetzner socks5h://91.232.225.120: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 gre.beget.ogw socks5h://91.232.225.124:1080
ikev2.beget.ogw socks5h://91.232.225.130: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