[Services] Restart Sflow service upon unexpected critical process exit.#3751
Merged
jleveque merged 6 commits intosonic-net:masterfrom Nov 25, 2019
yozhao101:Restart_Sflow
Merged
[Services] Restart Sflow service upon unexpected critical process exit.#3751jleveque merged 6 commits intosonic-net:masterfrom yozhao101:Restart_Sflow
jleveque merged 6 commits intosonic-net:masterfrom
yozhao101:Restart_Sflow
Conversation
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
processes file into dockerfile.j2. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
supervisord conf file. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
to restart this container more than 3 times in 20 minutes. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
shared Makefile docker-sflow.mk. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
jleveque
approved these changes
Nov 25, 2019
zhenggen-xu
pushed a commit
to zhenggen-xu/sonic-buildimage
that referenced
this pull request
Jan 10, 2020
…t. (sonic-net#3751) Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Restart Sflow service if one of critical processes running in Sflow container exited or crashed abnormally.
How I did it
Generally I follow the framework created by Joe to implement this feature in Sflow container.
First, add supervisor-proc-exit-listener event listener option in Supervisord configuration file in Sflow docker container. Supervisord will read a list of critical processes for which to monitor the unexpected crashed and exited.
Second, configure Sflow .service to always auto-restart the service if it stops, with a delay of 30 seconds. Also set a rate limit of 3 restarts within 20 minutes (1200 seconds).
How to verify it
On your switch device, please use docker ps command to list all running docker containers.
Then use docker exec -it container_id bash to login target container. Typing top command
on the shell will display all the processes dynamically and you will spot the process id of one
of the critical processes. Finally type the command kill -9 process_id to terminate one process.
After exiting the container, you can use watch -n 1 docker ps to dynamically see the restart
of Sflow container.