Skip to content

Commit c86af63

Browse files
committed
[Telemetry] enable default service config if no config from DB
Fix issue 16533, telemetry service exit in master and 202305 branches. Enable default config if no TELEMETRY configs from redis DB. After the fix, telemetry service would work with the following two scenarios: 1. With TELEMETRY config in redis DB, load service configs from DB. 2. No TELEMETRY config in redis DB, use default service configs.
1 parent 52f6dd6 commit c86af63

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dockers/docker-sonic-telemetry/telemetry.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
EXIT_TELEMETRY_VARS_FILE_NOT_FOUND=1
4-
INCORRECT_TELEMETRY_VALUE = 2
4+
INCORRECT_TELEMETRY_VALUE=2
55
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
66

77
if [ ! -f "$TELEMETRY_VARS_FILE" ]; then
@@ -75,7 +75,7 @@ THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
7575
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
7676
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
7777
else
78-
if [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
78+
if [ -z $GNMI ] || [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
7979
TELEMETRY_ARGS+=" --threshold 100"
8080
else
8181
echo "Incorrect threshold value, expecting positive integers" >&2
@@ -88,7 +88,7 @@ IDLE_CONN_DURATION=$(echo $GNMI | jq -r '.idle_conn_duration')
8888
if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then
8989
TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION"
9090
else
91-
if [[ $IDLE_CONN_DURATION == "null" ]]; then
91+
if [ -z $GNMI ] || [[ $IDLE_CONN_DURATION == "null" ]]; then
9292
TELEMETRY_ARGS+=" --idle_conn_duration 5"
9393
else
9494
echo "Incorrect idle_conn_duration value, expecting positive integers" >&2

0 commit comments

Comments
 (0)