Skip to content

Commit

Permalink
[Services] Restart Telemetry service upon unexpected critical process…
Browse files Browse the repository at this point in the history
… exit. (#3768)

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
  • Loading branch information
yozhao101 authored and jleveque committed Nov 19, 2019
1 parent f9e36d3 commit df11b2b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dockers/docker-sonic-telemetry/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ RUN apt-get clean -y && \

COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]

ENTRYPOINT ["/usr/bin/supervisord"]
2 changes: 2 additions & 0 deletions dockers/docker-sonic-telemetry/critical_processes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
telemetry
dialout
12 changes: 9 additions & 3 deletions dockers/docker-sonic-telemetry/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true

[eventlistener:supervisor-proc-exit-listener]
command=/usr/bin/supervisor-proc-exit-listener
events=PROCESS_STATE_EXITED
autostart=always
autorestart=unexpected

[program:start.sh]
command=/usr/bin/start.sh
priority=1
Expand All @@ -15,22 +21,22 @@ stderr_logfile=syslog
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
autorestart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog

[program:telemetry]
command=/usr/bin/telemetry.sh
priority=3
autostart=false
autorestart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:dialout]
command=/usr/bin/dialout.sh
priority=4
autostart=false
autorestart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
4 changes: 4 additions & 0 deletions files/build_templates/telemetry.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ Description=Telemetry container
Requires=database.service
After=database.service swss.service syncd.service
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3

[Service]
User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions rules/telemetry.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
SONIC_TELEMETRY = sonic-telemetry_0.1_$(CONFIGURED_ARCH).deb
$(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry
SONIC_DPKG_DEBS += $(SONIC_TELEMETRY)
$(SONIC_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

0 comments on commit df11b2b

Please sign in to comment.