Skip to content

Commit

Permalink
[chassis-packet][SNMP] Enable SNMP dynamic frequency on packet chassis (
Browse files Browse the repository at this point in the history
#21355)

Why I did it
It's one part of the fixes of #21314
SNMP walker request will always timeout when 100% CPU utilization.

Work item tracking
Microsoft ADO 30112399:

How I did it
Enable SNMP dynamic frequency on packet chassis.

How to verify it
snmp/test_snmp_cpu.py(https://github.com/sonic-net/sonic-mgmt/blob/master/tests/snmp/test_snmp_cpu.py) tests the scenario.
  • Loading branch information
yejianquan authored Jan 14, 2025
1 parent 34dfec7 commit df410ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dockers/docker-snmp/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ RUN apt-get -y purge \
find / | grep -E "__pycache__" | xargs rm -rf && \
rm -rf /debs /python-wheels ~/.cache

COPY ["docker-snmp-init.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]
COPY ["snmp_yml_to_configdb.py", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]

# Although exposing ports is not needed for host net mode, keep it for possible bridge mode
EXPOSE 161/udp 162/udp

ENTRYPOINT ["/usr/local/bin/supervisord"]
RUN chmod +x /usr/bin/docker-snmp-init.sh
ENTRYPOINT ["/usr/bin/docker-snmp-init.sh"]
5 changes: 5 additions & 0 deletions dockers/docker-snmp/docker-snmp-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#Generate supervisord.conf based on device metadata
mkdir -p /etc/supervisor/conf.d/
sonic-cfggen -d -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
exec /usr/local/bin/supervisord
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ dependent_startup=true
dependent_startup_wait_for=start:exited

[program:snmp-subagent]
{% if DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
command=/usr/bin/env python3 -m sonic_ax_impl --enable_dynamic_frequency
{% else %}
command=/usr/bin/env python3 -m sonic_ax_impl
{% endif %}
priority=4
autostart=false
autorestart=false
Expand Down

0 comments on commit df410ba

Please sign in to comment.