sonic-buildimage/dockers/docker-platform-monitor/docker_init.sh
mprabhu-nokia 00cea080af
Chassisd to monitor cards in a modular chassis (#5523)
HLD: Azure/SONiC#646

Introducing chassisd process to monitor status of the control, line and fabric cards in a modular chassis.

- Why I did it
Modular Chassis has control-cards, line-cards and fabric-cards along with other peripherals. Chassisd will be a central entity that has visibility of the entire chassis.

- How I did it
Chassisd process will monitor cards in the main thread. Another configuation_handling_task is created to listen to CONFIG_DB for admin_status up/down events. The monitored status is persisted in REDIS-DB.
2020-12-15 16:28:58 -08:00

50 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Generate supervisord config file and the start.sh scripts
mkdir -p /etc/supervisor/conf.d/
SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf"
FANCONTROL_CONF_FILE="/usr/share/sonic/platform/fancontrol"
MODULAR_CHASSISDB_CONF_FILE="/usr/share/sonic/platform/chassisdb.conf"
HAVE_SENSORS_CONF=0
HAVE_FANCONTROL_CONF=0
IS_MODULAR_CHASSIS=0
if [ -e $SENSORS_CONF_FILE ]; then
HAVE_SENSORS_CONF=1
fi
if [ -e $FANCONTROL_CONF_FILE ]; then
HAVE_FANCONTROL_CONF=1
fi
if [ -e $MODULAR_CHASSISDB_CONF_FILE ]; then
IS_MODULAR_CHASSIS=1
fi
confvar="{\"HAVE_SENSORS_CONF\":$HAVE_SENSORS_CONF, \"HAVE_FANCONTROL_CONF\":$HAVE_FANCONTROL_CONF, \"IS_MODULAR_CHASSIS\":$IS_MODULAR_CHASSIS}"
if [ -e /usr/share/sonic/platform/pmon_daemon_control.json ];
then
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -a "$confvar" -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
else
sonic-cfggen -a "$confvar" -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
fi
# If this platform has an lm-sensors config file, copy it to its proper place
if [ $HAVE_SENSORS_CONF -eq 1 ]; then
mkdir -p /etc/sensors.d
/bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/
fi
# If this platform has a fancontrol config file, copy it to its proper place
if [ $HAVE_FANCONTROL_CONF -eq 1 ]; then
# Remove stale pid file if it exists
rm -f /var/run/fancontrol.pid
/bin/cp -f $FANCONTROL_CONF_FILE /etc/
fi
exec /usr/local/bin/supervisord