QuecManager 1.0.2 BETA
- Added signal graphs for RSRP, RSRQ, and SINR - Added ethernet connection details - Added memory usage details - Added ping graph Known bug: Signal graphs may sometimes show inaccurate values. It seems to be a fetching error but Ill try to find the real root cause as soon as possible Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
This commit is contained in:
24
ipk-source/sdxpinn-quecmanager-beta/root/www/cgi-bin/home/ping_latency.sh
Executable file
24
ipk-source/sdxpinn-quecmanager-beta/root/www/cgi-bin/home/ping_latency.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set the content type to JSON
|
||||
echo "Content-Type: application/json"
|
||||
echo ""
|
||||
|
||||
# Ping 8.8.8.8 with 5 packets and capture the full output
|
||||
ping_result=$(ping -c 5 8.8.8.8)
|
||||
|
||||
# Check if ping was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
# Extract the average latency using awk
|
||||
avg_latency=$(echo "$ping_result" | awk '/avg/ {split($4, a, "/"); print int(a[2])}')
|
||||
|
||||
# If average latency was extracted, return it
|
||||
if [ ! -z "$avg_latency" ]; then
|
||||
echo "{\"connection\": \"ACTIVE\", \"latency\": $avg_latency}"
|
||||
else
|
||||
echo '{"connection": "ACTIVE", "latency": 0}'
|
||||
fi
|
||||
else
|
||||
# Ping failed
|
||||
echo '{"connection": "INACTIVE", "latency": 0}'
|
||||
fi
|
||||
Reference in New Issue
Block a user