[Services] Restart Telemetry service upon unexpected critical process exit. (#3768)

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This commit is contained in:
yozhao101 2019-11-18 16:56:44 -08:00 committed by Joe LeVeque
parent f9e36d3b0b
commit df11b2b9f1
5 changed files with 18 additions and 3 deletions

View File

@ -35,5 +35,7 @@ RUN apt-get clean -y && \
COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"] COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]
ENTRYPOINT ["/usr/bin/supervisord"] ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -0,0 +1,2 @@
telemetry
dialout

View File

@ -3,6 +3,12 @@ logfile_maxbytes=1MB
logfile_backups=2 logfile_backups=2
nodaemon=true 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] [program:start.sh]
command=/usr/bin/start.sh command=/usr/bin/start.sh
priority=1 priority=1
@ -15,7 +21,7 @@ stderr_logfile=syslog
command=/usr/sbin/rsyslogd -n command=/usr/sbin/rsyslogd -n
priority=2 priority=2
autostart=false autostart=false
autorestart=false autorestart=true
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
@ -23,7 +29,7 @@ stderr_logfile=syslog
command=/usr/bin/telemetry.sh command=/usr/bin/telemetry.sh
priority=3 priority=3
autostart=false autostart=false
autorestart=true autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
@ -31,6 +37,6 @@ stderr_logfile=syslog
command=/usr/bin/dialout.sh command=/usr/bin/dialout.sh
priority=4 priority=4
autostart=false autostart=false
autorestart=true autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog

View File

@ -3,12 +3,16 @@ Description=Telemetry container
Requires=database.service Requires=database.service
After=database.service swss.service syncd.service After=database.service swss.service syncd.service
Before=ntp-config.service Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
[Service] [Service]
User={{ sonicadmin_user }} User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -3,3 +3,4 @@
SONIC_TELEMETRY = sonic-telemetry_0.1_$(CONFIGURED_ARCH).deb SONIC_TELEMETRY = sonic-telemetry_0.1_$(CONFIGURED_ARCH).deb
$(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry $(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry
SONIC_DPKG_DEBS += $(SONIC_TELEMETRY) SONIC_DPKG_DEBS += $(SONIC_TELEMETRY)
$(SONIC_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)