From 93534ce0e12a8698d471be9ca94f490150ac8c00 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 5 Jun 2021 00:40:23 +0800 Subject: [PATCH 1/3] [Mellanox] Align PSU name convention returned from psu.get_name platform API (#7783) Make PSU name returned from platform API aligned with the convention "PSU {X}" instead of "PSU{X}". --- platform/mellanox/mlnx-platform-api/sonic_platform/psu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index e357a39141c..b6bb8257d06 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -80,7 +80,7 @@ def __init__(self, psu_index, platform): psu_oper_status = "thermal/psu{}_pwr_status".format(self.index) #psu_oper_status should always be present for all platforms self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status) - self._name = "PSU{}".format(psu_index + 1) + self._name = "PSU {}".format(psu_index + 1) if platform in platform_dict_psu: filemap = psu_profile_list[platform_dict_psu[platform]] From 9d05077431e3266ebadabb2d6d0e6ced1f0db1e8 Mon Sep 17 00:00:00 2001 From: Volodymyr Boiko <66446128+vboykox@users.noreply.github.com> Date: Fri, 4 Jun 2021 19:48:57 +0300 Subject: [PATCH 2/3] [barefoot][platform] Refactor chassis.py (#7704) #### Why I did it On our platforms syncd must be up while using the sonic_platform. The issue is warm-reboot script first disables syncd then instantiate Chassis, which tries to connect syncd in __init__. #### How I did it Refactor Chassis to lazy initialize components. Signed-off-by: Volodymyr Boyko --- .../sonic_platform/chassis.py | 47 ++++++++++++++----- .../sonic_platform/psu.py | 7 +++ .../sonic_platform/sfp.py | 7 +++ 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py index 47ebcb0e1ee..76e6895df2b 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py @@ -3,8 +3,8 @@ try: import sys from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform.sfp import Sfp - from sonic_platform.psu import Psu + from sonic_platform.sfp import Sfp, sfp_list_get + from sonic_platform.psu import psu_list_get from sonic_platform.fan_drawer import fan_drawer_list_get from sonic_platform.thermal import thermal_list_get from eeprom import Eeprom @@ -18,18 +18,21 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) - self._eeprom = Eeprom() - - for index in range(Sfp.port_start(), Sfp.port_end() + 1): - sfp_node = Sfp(index) - self._sfp_list.append(sfp_node) - - for i in range(1, Psu.get_num_psus() + 1): - psu = Psu(i) - self._psu_list.append(psu) - + self.__eeprom = None self.__fan_drawers = None self.__thermals = None + self.__psu_list = None + self.__sfp_list = None + + @property + def _eeprom(self): + if self.__eeprom is None: + self.__eeprom = Eeprom() + return self.__eeprom + + @_eeprom.setter + def _eeprom(self, value): + pass @property def _fan_drawer_list(self): @@ -51,6 +54,26 @@ def _thermal_list(self): def _thermal_list(self, value): pass + @property + def _psu_list(self): + if self.__psu_list is None: + self.__psu_list = psu_list_get() + return self.__psu_list + + @_psu_list.setter + def _psu_list(self, value): + pass + + @property + def _sfp_list(self): + if self.__sfp_list is None: + self.__sfp_list = sfp_list_get() + return self.__sfp_list + + @_sfp_list.setter + def _sfp_list(self, value): + pass + def get_name(self): """ Retrieves the name of the chassis diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py index cf9a84b2a6d..c63bb6528da 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py @@ -104,3 +104,10 @@ def get_model(self): def is_replaceable(self): return True + +def psu_list_get(): + psu_list = [] + for i in range(1, Psu.get_num_psus() + 1): + psu = Psu(i) + psu_list.append(psu) + return psu_list diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py index 739a48a8f1e..640b1c41948 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py @@ -269,3 +269,10 @@ def get_transceiver_threshold_info(self): def get_change_event(self, timeout=0): return Sfp.get_transceiver_change_event(timeout) + +def sfp_list_get(): + sfp_list = [] + for index in range(Sfp.port_start(), Sfp.port_end() + 1): + sfp_node = Sfp(index) + sfp_list.append(sfp_node) + return sfp_list From 1a3cab43ac5e2dd07ae447385c5eb5ed7f3f8666 Mon Sep 17 00:00:00 2001 From: yozhao101 <56170650+yozhao101@users.noreply.github.com> Date: Fri, 4 Jun 2021 10:16:53 -0700 Subject: [PATCH 3/3] [Monit] Deprecate the feature of monitoring the critical processes by Monit (#7676) Signed-off-by: Yong Zhao yozhao@microsoft.com Why I did it Currently we leveraged the Supervisor to monitor the running status of critical processes in each container and it is more reliable and flexible than doing the monitoring by Monit. So we removed the functionality of monitoring the critical processes by Monit. How I did it I removed the script process_checker and corresponding Monit configuration entries of critical processes. How to verify it I verified this on the device str-7260cx3-acs-1. --- .../base_image_files/monit_database | 7 -- .../docker-fpm-frr/base_image_files/monit_bgp | 27 ----- .../docker-lldp/base_image_files/monit_lldp | 15 --- .../base_image_files/monit_swss | 56 ----------- .../docker-sflow/base_image_files/monit_sflow | 7 -- .../docker-snmp/base_image_files/monit_snmp | 11 --- .../base_image_files/monit_restapi | 7 -- .../base_image_files/monit_telemetry | 9 -- .../docker-teamd/base_image_files/monit_teamd | 11 --- .../build_templates/sonic_debian_extension.j2 | 2 - files/image_config/monit/process_checker | 98 ------------------- platform/barefoot/docker-syncd-bfn.mk | 2 - .../base_image_files/monit_syncd | 7 -- platform/broadcom/docker-syncd-brcm.mk | 1 - .../base_image_files/monit_syncd | 11 --- platform/cavium/docker-syncd-cavm.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/centec/docker-syncd-centec.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/marvell-arm64/docker-syncd-mrvl.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/marvell-armhf/docker-syncd-mrvl.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/marvell/docker-syncd-mrvl.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/mellanox/docker-syncd-mlnx.mk | 1 - .../base_image_files/monit_syncd | 7 -- platform/nephos/docker-syncd-nephos.mk | 1 - .../base_image_files/monit_syncd | 11 --- rules/docker-database.mk | 1 - rules/docker-fpm-frr.mk | 1 - rules/docker-lldp.mk | 1 - rules/docker-orchagent.mk | 1 - rules/docker-restapi.mk | 1 - rules/docker-sflow.mk | 1 - rules/docker-snmp.mk | 1 - rules/docker-teamd.mk | 1 - 37 files changed, 339 deletions(-) delete mode 100644 dockers/docker-database/base_image_files/monit_database delete mode 100644 dockers/docker-fpm-frr/base_image_files/monit_bgp delete mode 100644 dockers/docker-lldp/base_image_files/monit_lldp delete mode 100644 dockers/docker-orchagent/base_image_files/monit_swss delete mode 100644 dockers/docker-sflow/base_image_files/monit_sflow delete mode 100644 dockers/docker-snmp/base_image_files/monit_snmp delete mode 100644 dockers/docker-sonic-restapi/base_image_files/monit_restapi delete mode 100644 dockers/docker-teamd/base_image_files/monit_teamd delete mode 100755 files/image_config/monit/process_checker delete mode 100644 platform/barefoot/docker-syncd-bfn/base_image_files/monit_syncd delete mode 100644 platform/broadcom/docker-syncd-brcm/base_image_files/monit_syncd delete mode 100644 platform/cavium/docker-syncd-cavm/base_image_files/monit_syncd delete mode 100644 platform/centec/docker-syncd-centec/base_image_files/monit_syncd delete mode 100644 platform/marvell-arm64/docker-syncd-mrvl/base_image_files/monit_syncd delete mode 100644 platform/marvell-armhf/docker-syncd-mrvl/base_image_files/monit_syncd delete mode 100644 platform/marvell/docker-syncd-mrvl/base_image_files/monit_syncd delete mode 100644 platform/mellanox/docker-syncd-mlnx/base_image_files/monit_syncd delete mode 100644 platform/nephos/docker-syncd-nephos/base_image_files/monit_syncd diff --git a/dockers/docker-database/base_image_files/monit_database b/dockers/docker-database/base_image_files/monit_database deleted file mode 100644 index 47c9d1b2d47..00000000000 --- a/dockers/docker-database/base_image_files/monit_database +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for database container -## process list: -## redis_server -############################################################################### -check program database|redis_server with path "/usr/bin/process_checker database /usr/bin/redis-server" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-fpm-frr/base_image_files/monit_bgp b/dockers/docker-fpm-frr/base_image_files/monit_bgp deleted file mode 100644 index 07705e84179..00000000000 --- a/dockers/docker-fpm-frr/base_image_files/monit_bgp +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################### -## Monit configuration for BGP container -## process list: -## zebra -## fpmsyncd -## bgpd -## staticd -## bgpcfgd -## bgpmon -############################################################################### -check program bgp|zebra with path "/usr/bin/process_checker bgp /usr/lib/frr/zebra" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program bgp|fpmsyncd with path "/usr/bin/process_checker bgp fpmsyncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program bgp|bgpd with path "/usr/bin/process_checker bgp /usr/lib/frr/bgpd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program bgp|staticd with path "/usr/bin/process_checker bgp /usr/lib/frr/staticd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program bgp|bgpcfgd with path "/usr/bin/process_checker bgp /usr/bin/python3 /usr/local/bin/bgpcfgd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program bgp|bgpmon with path "/usr/bin/process_checker bgp /usr/bin/python3 /usr/local/bin/bgpmon" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-lldp/base_image_files/monit_lldp b/dockers/docker-lldp/base_image_files/monit_lldp deleted file mode 100644 index d470972ace3..00000000000 --- a/dockers/docker-lldp/base_image_files/monit_lldp +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -## Monit configuration for lldp container -## process list: -## lldpd -## lldp-syncd -## lldpmgrd -############################################################################### -check program lldp|lldpd_monitor with path "/usr/bin/process_checker lldp lldpd:" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program lldp|lldp_syncd with path "/usr/bin/process_checker lldp python3 -m lldp_syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program lldp|lldpmgrd with path "/usr/bin/process_checker lldp python3 /usr/bin/lldpmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-orchagent/base_image_files/monit_swss b/dockers/docker-orchagent/base_image_files/monit_swss deleted file mode 100644 index d4ea5454ef6..00000000000 --- a/dockers/docker-orchagent/base_image_files/monit_swss +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################### -## Monit configuration for swss container -## process list: -## orchagent -## portsyncd -## neighsyncd -## fdbsyncd -## vrfmgrd -## vlanmgrd -## intfmgrd -## portmgrd -## buffermgrd -## nbrmgrd -## vxlanmgrd -## coppmgrd -## tunnelmgrd - -############################################################################## -check program swss|orchagent with path "/usr/bin/process_checker swss /usr/bin/orchagent -d /var/log/swss" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|portsyncd with path "/usr/bin/process_checker swss /usr/bin/portsyncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|neighsyncd with path "/usr/bin/process_checker swss /usr/bin/neighsyncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|fdbsyncd with path "/usr/bin/process_checker swss /usr/bin/fdbsyncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|vrfmgrd with path "/usr/bin/process_checker swss /usr/bin/vrfmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|vlanmgrd with path "/usr/bin/process_checker swss /usr/bin/vlanmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|intfmgrd with path "/usr/bin/process_checker swss /usr/bin/intfmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|portmgrd with path "/usr/bin/process_checker swss /usr/bin/portmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|buffermgrd with path "/usr/bin/process_checker swss /usr/bin/buffermgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|nbrmgrd with path "/usr/bin/process_checker swss /usr/bin/nbrmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|vxlanmgrd with path "/usr/bin/process_checker swss /usr/bin/vxlanmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|coppmgrd with path "/usr/bin/process_checker swss /usr/bin/coppmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program swss|tunnelmgrd with path "/usr/bin/process_checker swss /usr/bin/tunnelmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-sflow/base_image_files/monit_sflow b/dockers/docker-sflow/base_image_files/monit_sflow deleted file mode 100644 index 84b36b18ce6..00000000000 --- a/dockers/docker-sflow/base_image_files/monit_sflow +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for sflow container -## process list: -## sflowmgrd -############################################################################### -check program sflow|sflowmgrd with path "/usr/bin/process_checker sflow /usr/bin/sflowmgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-snmp/base_image_files/monit_snmp b/dockers/docker-snmp/base_image_files/monit_snmp deleted file mode 100644 index 6a368a9b603..00000000000 --- a/dockers/docker-snmp/base_image_files/monit_snmp +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -## Monit configuration for snmp container -## process list: -## snmpd -## snmpd_subagent -############################################################################### -check program snmp|snmpd with path "/usr/bin/process_checker snmp /usr/sbin/snmpd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program snmp|snmp_subagent with path "/usr/bin/process_checker snmp python3 -m sonic_ax_impl" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-sonic-restapi/base_image_files/monit_restapi b/dockers/docker-sonic-restapi/base_image_files/monit_restapi deleted file mode 100644 index 6752100b84f..00000000000 --- a/dockers/docker-sonic-restapi/base_image_files/monit_restapi +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for restapi container -## process list: -## restapi -############################################################################### -check program restapi|restapi with path "/usr/bin/process_checker restapi /usr/sbin/go-server-server" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry b/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry index ab3000c899d..b3ba8b25fe1 100644 --- a/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry +++ b/dockers/docker-sonic-telemetry/base_image_files/monit_telemetry @@ -1,14 +1,5 @@ ############################################################################### ## Monit configuration for telemetry container -## process list: -## telemetry -## dialout_client ############################################################################### -check program telemetry|telemetry with path "/usr/bin/process_checker telemetry /usr/sbin/telemetry" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program telemetry|dialout_client with path "/usr/bin/process_checker telemetry /usr/sbin/dialout_client_cli" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - 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" diff --git a/dockers/docker-teamd/base_image_files/monit_teamd b/dockers/docker-teamd/base_image_files/monit_teamd deleted file mode 100644 index 626a6145604..00000000000 --- a/dockers/docker-teamd/base_image_files/monit_teamd +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -## Monit configuration for teamd container -## process list: -## teamsyncd -## teammgrd -############################################################################### -check program teamd|teamsyncd with path "/usr/bin/process_checker teamd /usr/bin/teamsyncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program teamd|teammgrd with path "/usr/bin/process_checker teamd /usr/bin/teammgrd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 93e6ac35ebd..2285d656034 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -330,8 +330,6 @@ sudo cp $IMAGE_CONFIGS/monit/monitrc $FILESYSTEM_ROOT/etc/monit/ sudo chmod 600 $FILESYSTEM_ROOT/etc/monit/monitrc sudo cp $IMAGE_CONFIGS/monit/conf.d/* $FILESYSTEM_ROOT/etc/monit/conf.d/ sudo chmod 600 $FILESYSTEM_ROOT/etc/monit/conf.d/* -sudo cp $IMAGE_CONFIGS/monit/process_checker $FILESYSTEM_ROOT/usr/bin/ -sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/process_checker sudo cp $IMAGE_CONFIGS/monit/container_checker $FILESYSTEM_ROOT/usr/bin/ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/container_checker sudo cp $IMAGE_CONFIGS/monit/memory_checker $FILESYSTEM_ROOT/usr/bin/ diff --git a/files/image_config/monit/process_checker b/files/image_config/monit/process_checker deleted file mode 100755 index 68c8f3e945f..00000000000 --- a/files/image_config/monit/process_checker +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import ast -import sys -import syslog - -import psutil -from sonic_py_common import multi_asic -import swsssdk - - -def check_process_existence(container_name, process_cmdline): - """ - @summary: Check whether the process in the specified container is running or not and - an alerting message will written into syslog if it failed to run. - """ - config_db = swsssdk.ConfigDBConnector() - config_db.connect() - feature_table = config_db.get_table("FEATURE") - - if container_name in feature_table: - # We look into the 'FEATURE' table to verify whether the container is disabled or not. - # If the container is diabled, we exit. - if ("state" in feature_table[container_name] - and feature_table[container_name]["state"] == "disabled"): - sys.exit(0) - else: - # We leveraged the psutil library to help us check whether the process is running or not. - # If the process entity is found in process tree and it is also in the 'running' or 'sleeping' - # state, then it will be marked as 'running'. - - # For given feature we get the host and network namespace instances it's processes should be running - # based on it's scope and add it to expected set. - - # From psutil we get number of running instances of the processes and add it to the the actual set - - # Difference bwetween expected and actual set provides instances where the processes are not running - # and will be logged as syslog message by monit - - process_namespace_expected_set = set() - process_namespace_found_set = set() - - has_global_scope = ast.literal_eval(feature_table[container_name].get('has_global_scope', 'True')) - has_per_asic_scope = ast.literal_eval(feature_table[container_name].get('has_per_asic_scope', 'False')) - - if has_global_scope: - process_namespace_expected_set.add(multi_asic.DEFAULT_NAMESPACE) - - if has_per_asic_scope: - process_namespace_expected_set.update(multi_asic.get_namespace_list()) - - for process in psutil.process_iter(["cmdline", "status", "pid"]): - try: - if ((' '.join(process.cmdline())).startswith(process_cmdline) and process.status() in ["running", "sleeping"]): - process_namespace_found_set.add(multi_asic.get_current_namespace(process.info['pid'])) - except psutil.NoSuchProcess: - pass - - process_namespace_diff_set = process_namespace_expected_set.difference(process_namespace_found_set) - - if process_namespace_diff_set: - host_display_str = "" - namespace_display_str = "" - - for ns in process_namespace_diff_set: - if ns == multi_asic.DEFAULT_NAMESPACE: - host_display_str = " in host" - else: - if not namespace_display_str: - namespace_display_str = " in namespace " + ns - else: - namespace_display_str += ", " + ns - - join_str = " and" if host_display_str and namespace_display_str else "" - - # If this script is run by Monit, then the following output will be appended to - # Monit's syslog message. - print("'{}' is not running{}{}{}".format(process_cmdline, host_display_str, join_str, namespace_display_str)) - sys.exit(1) - else: - syslog.syslog(syslog.LOG_ERR, "container '{}' is not included in SONiC image or the given container name is invalid!" - .format(container_name)) - - -def main(): - parser = argparse.ArgumentParser(description="Check whether the process in the specified \ - container is running and an alerting message will be written into syslog if it \ - failed to run.", usage="/usr/bin/process_checker ") - parser.add_argument("container_name", help="container name") - parser.add_argument("process_cmdline", nargs=argparse.REMAINDER, help="process command line") - args = parser.parse_args() - - check_process_existence(args.container_name, ' '.join(args.process_cmdline)) - - -if __name__ == '__main__': - main() diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index 6c665abbfea..16b3085aa29 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -15,5 +15,3 @@ $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot - -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/barefoot/docker-syncd-bfn/base_image_files/monit_syncd b/platform/barefoot/docker-syncd-bfn/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/barefoot/docker-syncd-bfn/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index b1c4500de45..6f7d9680d88 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -20,4 +20,3 @@ $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /usr/share/sonic/device/x86_64-broadcom_commo $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcm_common:/usr/bin/bcm_common -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/monit_syncd b/platform/broadcom/docker-syncd-brcm/base_image_files/monit_syncd deleted file mode 100644 index d63346d9ee2..00000000000 --- a/platform/broadcom/docker-syncd-brcm/base_image_files/monit_syncd +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -## dsserve -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program syncd|dsserve with path "/usr/bin/process_checker syncd /usr/bin/dsserve /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 18db0768662..27984c80841 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -23,4 +23,3 @@ $(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_SYNCD_CAVM)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/cavium/docker-syncd-cavm/base_image_files/monit_syncd b/platform/cavium/docker-syncd-cavm/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/cavium/docker-syncd-cavm/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index 65ac38d59f4..f8fc1e83967 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -17,4 +17,3 @@ $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_SYNCD_CENTEC)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/centec/docker-syncd-centec/base_image_files/monit_syncd b/platform/centec/docker-syncd-centec/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/centec/docker-syncd-centec/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/marvell-arm64/docker-syncd-mrvl.mk b/platform/marvell-arm64/docker-syncd-mrvl.mk index f35ce7fa36b..228ca04428b 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -17,4 +17,3 @@ $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-arm64/docker-syncd-mrvl/base_image_files/monit_syncd b/platform/marvell-arm64/docker-syncd-mrvl/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/marvell-arm64/docker-syncd-mrvl/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/marvell-armhf/docker-syncd-mrvl.mk b/platform/marvell-armhf/docker-syncd-mrvl.mk index 65f60697506..39135311ba4 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl.mk @@ -14,4 +14,3 @@ $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd #$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-armhf/docker-syncd-mrvl/base_image_files/monit_syncd b/platform/marvell-armhf/docker-syncd-mrvl/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/marvell-armhf/docker-syncd-mrvl/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index d7617aac186..2980ae17a88 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -18,4 +18,3 @@ $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell/docker-syncd-mrvl/base_image_files/monit_syncd b/platform/marvell/docker-syncd-mrvl/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/marvell/docker-syncd-mrvl/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 6e6a17c7770..e77010ef2de 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -18,4 +18,3 @@ $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/mellanox/docker-syncd-mlnx/base_image_files/monit_syncd b/platform/mellanox/docker-syncd-mlnx/base_image_files/monit_syncd deleted file mode 100644 index 61e290e3189..00000000000 --- a/platform/mellanox/docker-syncd-mlnx/base_image_files/monit_syncd +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index 7076a3803c7..d191acc13c7 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -21,4 +21,3 @@ $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag -$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/nephos/docker-syncd-nephos/base_image_files/monit_syncd b/platform/nephos/docker-syncd-nephos/base_image_files/monit_syncd deleted file mode 100644 index d63346d9ee2..00000000000 --- a/platform/nephos/docker-syncd-nephos/base_image_files/monit_syncd +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -## Monit configuration for syncd container -## process list: -## syncd -## dsserve -############################################################################### -check program syncd|syncd with path "/usr/bin/process_checker syncd /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles - -check program syncd|dsserve with path "/usr/bin/process_checker syncd /usr/bin/dsserve /usr/bin/syncd" - if status != 0 for 5 times within 5 cycles then alert repeat every 1 cycles diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 1f903788020..9f977f09616 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -26,6 +26,5 @@ $(DOCKER_DATABASE)_RUN_OPT += --privileged -t $(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli -$(DOCKER_DATABASE)_BASE_IMAGE_FILES += monit_database:/etc/monit/conf.d $(DOCKER_DATABASE)_FILES += $(SYSCTL_NET_CONFIG) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_DATABASE)_FILES += $(UPDATE_CHASSISDB_CONFIG_SCRIPT) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 601671da3b8..d7b38405cb7 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -35,4 +35,3 @@ $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSA:/usr/bin/TSA $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSB:/usr/bin/TSB $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSC:/usr/bin/TSC $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TS:/usr/bin/TS -$(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += monit_bgp:/etc/monit/conf.d diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index 08e765ecdd6..f2432ab6335 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -32,5 +32,4 @@ $(DOCKER_LLDP)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:r $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpcli:/usr/bin/lldpcli -$(DOCKER_LLDP)_BASE_IMAGE_FILES += monit_lldp:/etc/monit/conf.d $(DOCKER_LLDP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index ff54642d8ff..f545a64cb98 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -35,5 +35,4 @@ $(DOCKER_ORCHAGENT)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT)_BASE_IMAGE_FILES += monit_swss:/etc/monit/conf.d $(DOCKER_ORCHAGENT)_FILES += $(ARP_UPDATE_SCRIPT) $(ARP_UPDATE_VARS_TEMPLATE) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index 1df80f26d94..1c54bde741b 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -26,4 +26,3 @@ $(DOCKER_RESTAPI)_RUN_OPT += -v /etc/sonic/credentials:/etc/sonic/credentials:ro $(DOCKER_RESTAPI)_RUN_OPT += -p=8081:8081/tcp $(DOCKER_RESTAPI)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -$(DOCKER_RESTAPI)_BASE_IMAGE_FILES += monit_restapi:/etc/monit/conf.d diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index 959afed883e..7291e5d216b 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -33,5 +33,4 @@ $(DOCKER_SFLOW)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SFLOW)_BASE_IMAGE_FILES += psample:/usr/bin/psample $(DOCKER_SFLOW)_BASE_IMAGE_FILES += sflowtool:/usr/bin/sflowtool -$(DOCKER_SFLOW)_BASE_IMAGE_FILES += monit_sflow:/etc/monit/conf.d $(DOCKER_SFLOW)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index cf6d14c40b3..96a783d7a5a 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -31,4 +31,3 @@ $(DOCKER_SNMP)_RUN_OPT += --privileged -t $(DOCKER_SNMP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SNMP)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro $(DOCKER_SNMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -$(DOCKER_SNMP)_BASE_IMAGE_FILES += monit_snmp:/etc/monit/conf.d diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 088860fb5d6..c6955bea5ca 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -30,5 +30,4 @@ $(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TEAMD)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_TEAMD)_BASE_IMAGE_FILES += teamdctl:/usr/bin/teamdctl -$(DOCKER_TEAMD)_BASE_IMAGE_FILES += monit_teamd:/etc/monit/conf.d $(DOCKER_TEAMD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)