sonic-buildimage/dockers/docker-orchagent
yozhao101 be3c036794
[supervisord] Monitoring the critical processes with supervisord. (#6242)
- Why I did it
Initially, we used Monit to monitor critical processes in each container. If one of critical processes was not running
or crashed due to some reasons, then Monit will write an alerting message into syslog periodically. If we add a new process
in a container, the corresponding Monti configuration file will also need to update. It is a little hard for maintenance.

Currently we employed event listener of Supervisod to do this monitoring. Since processes in each container are managed by
Supervisord, we can only focus on the logic of monitoring.

- How I did it
We borrowed the event listener of Supervisord to monitor critical processes in containers. The event listener will take
following steps if it was notified one of critical processes exited unexpectedly:

The event listener will first check whether the auto-restart mechanism was enabled for this container or not. If auto-restart mechanism was enabled, event listener will kill the Supervisord process, which should cause the container to exit and subsequently get restarted.

If auto-restart mechanism was not enabled for this contianer, the event listener will enter a loop which will first sleep 1 minute and then check whether the process is running. If yes, the event listener exits. If no, an alerting message will be written into syslog.

- How to verify it
First, we need checked whether the auto-restart mechanism of a container was enabled or not by running the command show feature status. If enabled, one critical process should be selected and killed manually, then we need check whether the container will be restarted or not.

Second, we can disable the auto-restart mechanism if it was enabled at step 1 by running the commnad sudo config feature autorestart <container_name> disabled. Then one critical process should be selected and killed. After that, we will see the alerting message which will appear in the syslog every 1 minute.

- Which release branch to backport (provide reason below if selected)

 201811
 201911
[x ] 202006
2021-01-21 12:57:49 -08:00
..
base_image_files [submodule]: swss Tunnel Manager changes (#5843) 2020-12-26 11:17:18 -08:00
arp_update.conf [docker-orchagent]: use service dependency in supervisord to start services 2020-05-22 11:01:28 -07:00
buffermgrd.sh [Dynamic buffer calc] Support dynamic buffer calculation (#6194) 2020-12-13 11:35:39 -08:00
critical_processes [submodule]: swss Tunnel Manager changes (#5843) 2020-12-26 11:17:18 -08:00
docker-init.sh Copp Manager Changes (#4861) 2020-11-23 09:31:42 -08:00
Dockerfile.j2 [docker-base-buster][docker-config-engine-buster] No longer install Python 2 (#6162) 2020-12-25 21:29:25 -08:00
enable_counters.py [Python] Align files in root dir, dockers/ and files/ with PEP8 standards (#6109) 2020-12-03 15:57:50 -08:00
ipinip.json.j2 [ipinip.json.j2] align mellanox configuration dst_ip with other platforms (#6304) 2020-12-28 20:53:12 -08:00
ndppd.conf [docker-orchagent]: Add NDP Proxy Daemon (#5517) 2020-10-05 08:48:13 -07:00
ndppd.conf.j2 [docker-orchagent]: Add NDP Proxy Daemon (#5517) 2020-10-05 08:48:13 -07:00
orchagent.sh [synchronous-mode] Add template file for synchronous mode (#5644) 2020-10-23 13:08:35 -07:00
ports.json.j2 [cfggen] Make Jinja2 Template Python 3 Compatible 2020-09-30 07:07:43 -07:00
supervisord.conf [supervisord] Monitoring the critical processes with supervisord. (#6242) 2021-01-21 12:57:49 -08:00
switch.json.j2 Make backend device checking more robust (#5730) 2020-11-10 15:06:35 -08:00
swssconfig.sh Copp Manager Changes (#4861) 2020-11-23 09:31:42 -08:00
vlan_vars.j2 [swss] Reduce Calls to SONiC Cfggen (#5177) 2020-08-17 15:47:52 -07:00