sonic-buildimage/files/image_config
yozhao101 e24fe9bc60
[Monit] Fix the issue which shows Monit can not reset its counter. (#10288)
Signed-off-by: Yong Zhao <yozhao@microsoft.com>

Why I did it
This PR aims to fix the Monit issue which shows Monit can't reset its counter when monitoring memory usage of telemetry container.

Specifically the Monit configuration file related to monitoring memory usage of telemetry container is as following:

  check program container_memory_telemetry with path "/usr/bin/memory_checker telemetry 419430400"
      if status == 3 for 10 times within 20 cycles then exec "/usr/bin/restart_service telemetry"
If memory usage of telemetry container is larger than 400MB for 10 times within 20 cycles (minutes), then it will be restarted.
Recently we observed, after telemetry container was restarted, its memory usage continuously increased from 400MB to 11GB within 1 hour, but it was not restarted anymore during this 1 hour sliding window.

The reason is Monit can't reset its counter to count again and Monit can reset its counter if and only if the status of monitored service was changed from Status failed to Status ok. However, during this 1 hour sliding window, the status of monitored service was not changed from Status failed to Status ok.

Currently for each service monitored by Monit, there will be an entry showing the monitoring status, monitoring mode etc. For example, the following output from command sudo monit status shows the status of monitored service to monitor memory usage of telemetry:

    Program 'container_memory_telemetry'
         status                             Status ok
         monitoring status          Monitored
         monitoring mode          active
         on reboot                      start
         last exit value                0
         last output                    -
         data collected               Sat, 19 Mar 2022 19:56:26
Every 1 minute, Monit will run the script to check the memory usage of telemetry and update the counter if memory usage is larger than 400MB. If Monit checked the counter and found memory usage of telemetry is larger than 400MB for 10 times
within 20 minutes, then telemetry container was restarted. Following is an example status of monitored service:

    Program 'container_memory_telemetry'
         status                             Status failed
         monitoring status          Monitored
         monitoring mode          active
         on reboot                      start
         last exit value                0
         last output                    -
         data collected               Tue, 01 Feb 2022 22:52:55
After telemetry container was restarted. we found memory usage of telemetry increased rapidly from around 100MB to more than 400MB during 1 minute and status of monitored service did not have a chance to be changed from Status failed to Status ok.

How I did it
In order to provide a workaround for this issue, Monit recently introduced another syntax format repeat every <n> cycles related to exec. This new syntax format will enable Monit repeat executing the background script if the error persists for a given number of cycles.

How to verify it
I verified this change on lab device str-s6000-acs-12. Another pytest PR (Azure/sonic-mgmt#5492) is submitted in sonic-mgmt repo for review.
2022-04-20 18:08:06 -07:00
..
bash Close console session due to user inactivity (#9890) 2022-02-02 09:41:21 +05:30
config-chassisdb [ChassisDB]: bring up ChassisDB service (#5283) 2020-10-14 15:15:24 -07:00
config-setup [port_config] Introduce ad-hoc mport_config.json file (#8066) 2021-07-15 08:56:35 +08:00
constants [chassis] Add templates and code to support VoQ chassis iBGP peers (#5622) 2021-04-16 11:11:32 -07:00
copp [CoPP] Add always_enabled field (#9302) 2021-11-30 11:04:15 -08:00
corefile_uploader [Python] Align files in root dir, dockers/ and files/ with PEP8 standards (#6109) 2020-12-03 15:57:50 -08:00
cron.d [core_cleanup] Fix issue where core_cleanup job runs too frequently (#3659) 2019-10-23 15:55:47 -07:00
ebtables [baseimage]: Updates for Ebtables and support for multi-asic (#6542) 2021-01-27 08:36:10 -08:00
environment [image]: Update login message (#706) 2017-06-14 15:18:02 -07:00
fstrim [202012][fstrim] delay fstrim timer after sonic.target (#8737) 2021-09-13 07:37:46 -07:00
hostname [services] introduce sonic.target (#5705) 2021-02-25 14:26:24 +02:00
interfaces [interfaces-config] "main exception: cannot find interfaces: eth0" error log avoided (#10463) 2022-04-06 16:59:47 +03:00
kdump [kdump] Fix kdump error message when a reboot is issued (#7985) 2021-07-01 11:52:38 -07:00
kubernetes [baseimage]: Install Kubernetes packages if enabled in image (#4374) 2020-04-13 08:41:18 -07:00
logrotate [Arista] Remove arista.log from rsyslog default logrotate (#9731) 2022-03-11 08:09:07 -08:00
misc [Python] Align files in root dir, dockers/ and files/ with PEP8 standards (#6109) 2020-12-03 15:57:50 -08:00
monit [Monit] Fix the issue which shows Monit can not reset its counter. (#10288) 2022-04-20 18:08:06 -07:00
ntp [ntp] Fix ntp.conf template to allow setting of source port in CONFIG_DB (#7586) 2021-05-23 13:40:43 -07:00
pcie-check Support multiple pcie configuration file and change the pcie status table name to match with pcied changes (#7886) 2021-06-16 16:05:48 -07:00
platform Refactoring DELL platform init to reduce rc.local processing time porting changes in master (#10318) 2022-03-24 11:14:37 -07:00
rsyslog [multi-asic] fix syslog not getting generated. (#9160) 2021-11-03 18:29:09 -07:00
secureboot [port_config] Introduce ad-hoc mport_config.json file (#8066) 2021-07-15 08:56:35 +08:00
snmp mvrf_avoid_snmp_yml_config: made changes to pass SNMP config from con… (#4057) 2020-01-28 17:41:21 -08:00
sudoers Close console session due to user inactivity (#9890) 2022-02-02 09:41:21 +05:30
sysctl Enable sysctl fib_multipath_use_neigh (#8502) 2021-08-18 15:53:17 -07:00
syslog [baseimage]: /host unmount timeout issue during reboot. (#5032) 2020-07-25 01:27:58 -07:00
system-health [system-health] Add support for monitoring system health (#4835) 2020-10-12 11:12:49 +03:00
systemd [systemd] disable default systemd udev rules for interfaces (#7369) 2021-04-21 17:50:00 -07:00
topology [multi-asic][vs]: Update topology script to retrieve hwsku from minigraph (#6219) 2021-02-18 22:02:29 -08:00
updategraph [platform] Add Support For Environment Variable File (#5010) 2020-07-31 17:59:09 -07:00
warmboot-finalizer [SONiC Application Extension] support warm/fast reboot for extension packages (#7286) 2021-07-11 06:58:05 -07:00
watchdog-control [sonic-utilities] Build and install as a Python wheel package (#5409) 2020-09-20 20:16:42 -07:00