From 1508269ac9c2fc9168e880bae6ca06ab01f0fd80 Mon Sep 17 00:00:00 2001 From: Tamer Ahmed Date: Wed, 12 Aug 2020 15:40:14 -0700 Subject: [PATCH] [snmp]: Reduce Calls to SONiC Cfggen Calls to sonic-cfggen is CPU expensive. This PR reduces calls to sonic-cfggen to once calle during snmp startup singed-off-by: Tamer Ahmed --- dockers/docker-snmp/start.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dockers/docker-snmp/start.sh b/dockers/docker-snmp/start.sh index c4929738f9d8..37ba3577e597 100755 --- a/dockers/docker-snmp/start.sh +++ b/dockers/docker-snmp/start.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash -mkdir -p /etc/ssw -sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription +mkdir -p /etc/ssw /etc/snmp -mkdir -p /etc/snmp -sonic-cfggen -d -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf +SONIC_CFGGEN_ARGS=" \ + -d \ + -y /etc/sonic/sonic_version.yml \ + -t /usr/share/sonic/templates/sysDescription.j2,/etc/ssw/sysDescription \ + -y /etc/sonic/snmp.yml \ + -t /usr/share/sonic/templates/snmpd.conf.j2,/etc/snmp/snmpd.conf \ +" + +sonic-cfggen $SONIC_CFGGEN_ARGS mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status