Skip to content

Commit

Permalink
Add Link Quality check support for httping in OMR-Tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Nov 15, 2024
1 parent d4e18ee commit 7a89fb0
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions omr-tracker/files/bin/omr-tracker
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ _ping() {
"${host}" 2>&1
)
loss=$(echo "$ret" | awk '/packet loss/ {gsub("%","");print $6}' | tr -d '\n')

if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
latency=$(echo "$ret" | awk -F/ '/rtt/ {print int($5)}' | tr -d '\n')
Expand Down Expand Up @@ -205,7 +206,7 @@ _ping() {
fi
false
}

#'
_httping() {
local host=$1
local deviceip=$2
Expand All @@ -216,25 +217,41 @@ _httping() {
-y "${deviceip}" \
-t "$OMR_TRACKER_TIMEOUT" \
-c "$OMR_TRACKER_COUNT" 2>&1
) && echo "$ret" | grep -sq "1 ok" && {
)
bindcheck=$(echo "$ret" | grep "Address not available")
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
#_update_rto "$OMR_TRACKER_LATENCY"
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
[ -n "$latency" ] && {
OMR_TRACKER_LATENCY="$latency"
#_update_rto "$OMR_TRACKER_LATENCY"
}
OMR_TRACKER_LOSS="$loss"
fi
return
}
fi
else
ret=$(httping -l "${host}" \
-y "${deviceip}" \
-t "$OMR_TRACKER_TIMEOUT" \
-c "$OMR_TRACKER_COUNT" 2>&1
) && echo "$ret" | grep -sq "1 ok" && {
)
bindcheck=$(echo "$ret" | grep "Address not available")
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
#_update_rto "$OMR_TRACKER_LATENCY"
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
[ -n "$latency" ] && {
OMR_TRACKER_LATENCY="$latency"
#_update_rto "$OMR_TRACKER_LATENCY"
}
OMR_TRACKER_LOSS="$loss"
fi
return
}
fi
fi
false
}
Expand Down

0 comments on commit 7a89fb0

Please sign in to comment.