mirror of
https://github.com/Telecominfraproject/ols-nos.git
synced 2025-12-22 07:47:18 +00:00
Add idle conn duration config to telemetry.sh (#14903)
Why I did it Supports new field in sonic-net/sonic-gnmi@258b887 Work item tracking Microsoft ADO (number only): 13468195 How I did it Add new field in telemetry.sh How to verify it Pipeline
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
EXIT_TELEMETRY_VARS_FILE_NOT_FOUND=1
|
EXIT_TELEMETRY_VARS_FILE_NOT_FOUND=1
|
||||||
|
INCORRECT_TELEMETRY_VALUE = 2
|
||||||
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
|
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
|
||||||
|
|
||||||
if [ ! -f "$TELEMETRY_VARS_FILE" ]; then
|
if [ ! -f "$TELEMETRY_VARS_FILE" ]; then
|
||||||
@@ -69,11 +70,31 @@ else
|
|||||||
TELEMETRY_ARGS+=" -v=2"
|
TELEMETRY_ARGS+=" -v=2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Server will handle threshold connections consecutively
|
||||||
THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
|
THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
|
||||||
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
|
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
|
||||||
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
|
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
|
||||||
else
|
else
|
||||||
|
if [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
|
||||||
TELEMETRY_ARGS+=" --threshold 100"
|
TELEMETRY_ARGS+=" --threshold 100"
|
||||||
|
else
|
||||||
|
echo "Incorrect threshold value, expecting positive integers" >&2
|
||||||
|
exit $INCORRECT_TELEMETRY_VALUE
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Close idle connections after certain duration (in seconds)
|
||||||
|
IDLE_CONN_DURATION=$(echo $GNMI | jq -r '.idle_conn_duration')
|
||||||
|
if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then
|
||||||
|
TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION"
|
||||||
|
else
|
||||||
|
if [[ $IDLE_CONN_DURATION == "null" ]]; then
|
||||||
|
TELEMETRY_ARGS+=" --idle_conn_duration 5"
|
||||||
|
else
|
||||||
|
echo "Incorrect idle_conn_duration value, expecting positive integers" >&2
|
||||||
|
exit $INCORRECT_TELEMETRY_VALUE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
exec /usr/sbin/telemetry ${TELEMETRY_ARGS}
|
exec /usr/sbin/telemetry ${TELEMETRY_ARGS}
|
||||||
|
|||||||
Reference in New Issue
Block a user