sonic-buildimage/dockers/docker-fpm-quagga
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 Manually send SIGHUP to vtysh when the current session was disconnected (#1801) 2018-06-20 12:15:09 -07:00
bgpcfgd [Python] Align files in root dir, dockers/ and files/ with PEP8 standards (#6109) 2020-12-03 15:57:50 -08:00
bgpd.conf.j2 [cfggen] Make Jinja2 Template Python 3 Compatible 2020-09-30 07:07:43 -07:00
critical_processes [dockers] Update critical_processes file syntax (#4831) 2020-06-25 21:18:21 -07:00
Dockerfile.j2 [supervisord]: use abspath as supervisord entrypoint (#5995) 2020-11-22 21:18:44 -08:00
isolate.j2 [bgp]: Fix isolate/unisolate command for ipv6 peers (#3183) 2019-07-18 16:34:26 -07:00
start.sh [frr] Reduce Calls to SONiC Cfggen (#5176) 2020-08-17 15:47:42 -07:00
supervisord.conf [supervisord] Monitoring the critical processes with supervisord. (#6242) 2021-01-21 12:57:49 -08:00
unisolate.j2 [bgp]: Fix isolate/unisolate command for ipv6 peers (#3183) 2019-07-18 16:34:26 -07:00
zebra.conf.j2 Generate interface table to have an entry designated to default VRF. (#2848) 2019-06-10 14:02:55 -07:00