Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pmon] dynamically load pmon daemons #2654

Merged
merged 3 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"skip_ledd": true
}

6 changes: 3 additions & 3 deletions dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RUN apt-get autoclean -y
RUN apt-get autoremove -y
RUN rm -rf /debs /python-wheels ~/.cache

COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"]

ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/docker_init.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

{% if not skip_ledd %}
[program:ledd]
command=/usr/bin/ledd
priority=5
Expand All @@ -45,7 +46,9 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0
{% endif %}

{% if not skip_xcvrd %}
[program:xcvrd]
command=/usr/bin/xcvrd
priority=6
Expand All @@ -54,7 +57,9 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0
{% endif %}

{% if not skip_psud %}
[program:psud]
command=/usr/bin/psud
priority=7
Expand All @@ -63,4 +68,4 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0

{% endif %}
18 changes: 18 additions & 0 deletions dockers/docker-platform-monitor/docker_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Generate supervisord config file and the start.sh scripts
mkdir -p /etc/supervisor/conf.d/

if [ -e /usr/share/sonic/platform/pmon_daemon_control.json ];
then
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -t /usr/share/sonic/templates/start.sh.j2 > /usr/bin/start.sh
chmod +x /usr/bin/start.sh
else
sonic-cfggen -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -t /usr/share/sonic/templates/start.sh.j2 > /usr/bin/start.sh
chmod +x /usr/bin/start.sh
fi

exec /usr/bin/supervisord

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then
supervisorctl start fancontrol
fi

{% if not skip_ledd %}
supervisorctl start ledd
{% endif %}

{% if not skip_xcvrd %}
supervisorctl start xcvrd
{% endif %}

{% if not skip_psud %}
supervisorctl start psud
{% endif %}