sonic-buildimage/platform/cavium
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
..
cavm_platform_modules [kernel]: upgrade linux kernel to 4.9.118 (#4897) 2020-07-12 18:08:51 +00:00
cavm_sdk Added rules to build syncd and orchagent containers for Cavium target (#152) 2016-12-23 15:26:51 -08:00
docker-saiserver-cavm [supervisord]: use abspath as supervisord entrypoint (#5995) 2020-11-22 21:18:44 -08:00
docker-syncd-cavm [supervisord] Monitoring the critical processes with supervisord. (#6242) 2021-01-21 12:57:49 -08:00
docker-syncd-cavm-rpc [supervisord]: use abspath as supervisord entrypoint (#5995) 2020-11-22 21:18:44 -08:00
cavm-platform-modules.mk [build]: add buster docker as the last step of the build proces 2020-04-16 10:26:18 +00:00
cavm-sai.mk [cavm]Update sai revision and packet driver (#914) 2017-08-24 23:46:14 -07:00
cavm-xpnet.mk [build]: add buster docker as the last step of the build proces 2020-04-16 10:26:18 +00:00
docker-ptf-cavm.mk [build]: add docker-ptf-* as stretch docker targets (#4516) 2020-05-01 11:20:33 -07:00
docker-syncd-cavm-rpc.mk [redis] Install vanilla redis packages for Buster and Stretch; upgrade Buster to 6.0.5 (#4732) 2020-06-27 01:17:20 -07:00
docker-syncd-cavm.mk [redis] Install vanilla redis packages for Buster and Stretch; upgrade Buster to 6.0.5 (#4732) 2020-06-27 01:17:20 -07:00
libsaithrift-dev.mk [saithrift]: remove dependency on python-saithrift (#2584) 2019-02-18 02:50:37 -08:00
one-image.mk [build]: Move Systemd service start to systemd generator (#3172) 2019-07-29 15:52:15 -07:00
platform.conf one image implementation (#215) 2017-01-29 11:33:33 -08:00
rules.mk [build]: wait for conflicts package to be uninstalled (#5039) 2020-07-27 10:46:20 -07:00