Skip to content

[SNMP] Fix config template issue when setting snmpagentaddress#20152

Merged
qiluo-msft merged 1 commit intosonic-net:masterfrom
brholmes1:master_snmpagentaddress
Feb 26, 2025
Merged

[SNMP] Fix config template issue when setting snmpagentaddress#20152
qiluo-msft merged 1 commit intosonic-net:masterfrom
brholmes1:master_snmpagentaddress

Conversation

@brholmes1
Copy link
Contributor

@brholmes1 brholmes1 commented Sep 5, 2024

Related to PR#16187

Why I did it

When you configure an SNMP agent address with a VRF, the snmpd service will fail to properly start after the configuration has been applied. The snmpd service shows a status of "FATAL."

sudo config snmpagentaddress add 1.1.1.1 -p 161 -v mgmt

docker exec -it snmp supervisorctl status | awk '{print $1, $2}'
dependent-startup RUNNING
rsyslogd RUNNING
snmp-subagent STOPPED
snmpd FATAL
start EXITED
supervisor-proc-exit-listener RUNNING
Work item tracking
  • Microsoft ADO (number only):

How I did it

Corrected syntax in the jinja template used to generate the snmpd.conf within the SNMP docker container.

How to verify it

sudo config snmpagentaddress add 1.1.1.1 -p 161 -v mgmt

docker exec -it snmp supervisorctl status | awk '{print $1, $2}'
dependent-startup EXITED
rsyslogd RUNNING
snmp-subagent RUNNING
snmpd RUNNING
start EXITED
supervisor-proc-exit-listener RUNNING

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202311
  • 202405

Tested branch (Please provide the tested image version)

  • SONiC.master.634739-2ff111cb9
  • SONiC.202405.565256-4d6d808b8
  • SONiC-OS-202311.634628-3cc3e1a11

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 5, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@brholmes1 brholmes1 force-pushed the master_snmpagentaddress branch from 0937e70 to 8735dae Compare September 6, 2024 15:42
@brholmes1 brholmes1 marked this pull request as ready for review September 6, 2024 18:30
@brholmes1
Copy link
Contributor Author

@qiluo-msft Can you please help review? Thanks!

@dgsudharsan
Copy link
Collaborator

@SuvarnaMeenakshi Can you please review and sign-off?

{% if SNMP_AGENT_ADDRESS_CONFIG %}
{% for (agentip, port, vrf) in SNMP_AGENT_ADDRESS_CONFIG %}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if port %}:{{ port }}{% endif %}{% if vrf %}%{{ vrf }}{% endif %}{{ "" }}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if vrf %}@{{ vrf }}{% endif %}{% if port %}:{{ port }}{% endif %}{{ "" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@{{ vrf }} - should it be ip@vrf or ip%vrf ?
Do we need a sonic-mgmt test for this feature ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, ip%vrf would not resolve the issue. Using the ip@vrf format ultimately allowed for the VRF to be configured and is what I am using in my environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brholmes1 can you help add a sonic-mgmt test case for snmp with vrf?

stepanblyschak pushed a commit to stepanblyschak/sonic-buildimage that referenced this pull request Jan 27, 2025
dgsudharsan pushed a commit to dgsudharsan/sonic-buildimage that referenced this pull request Jan 29, 2025
dgsudharsan pushed a commit to dgsudharsan/sonic-buildimage that referenced this pull request Jan 29, 2025
@dprital
Copy link
Collaborator

dprital commented Feb 11, 2025

@brholmes1 , Can you please check checkers failure ? and also comment on the review ?

@brholmes1
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SuvarnaMeenakshi
Copy link
Contributor

Approved, requesting to add a sonic-mgmt test for this.

@dprital
Copy link
Collaborator

dprital commented Feb 19, 2025

@qiluo-msft , Can you please merge ?

@liat-grozovik liat-grozovik changed the title [master][SNMP] Fix config template issue when setting snmpagentaddress [SNMP] Fix config template issue when setting snmpagentaddress Feb 25, 2025
@qiluo-msft qiluo-msft merged commit b6c9614 into sonic-net:master Feb 26, 2025
18 checks passed
@gechiang
Copy link
Collaborator

@brholmes1 can you please add the missing test coverage for this PR by raising another PR?
Thanks!

@brholmes1
Copy link
Contributor Author

Yes, I will work on adding the missing test coverage and raise a new PR. Thanks!

@dgsudharsan
Copy link
Collaborator

@kperumalbfn Can you please help cherry-pick this fix to 202411?

@kperumalbfn
Copy link
Contributor

@brholmes1 could you add sonic-mgmt tests for this change and let us know. We will include that in 202411 as well. Since we are planning to stabilize 202411, will be good to have the tests included in 202411 as well.

miatttao pushed a commit to miatttao/sonic-buildimage that referenced this pull request Mar 5, 2025
…-net#20152)

Related to PR#16187

Why I did it
When you configure an SNMP agent address with a VRF, the snmpd service will fail to properly start after the configuration has been applied. The snmpd service shows a status of "FATAL."

sudo config snmpagentaddress add 1.1.1.1 -p 161 -v mgmt

docker exec -it snmp supervisorctl status | awk '{print $1, $2}'
dependent-startup RUNNING
rsyslogd RUNNING
snmp-subagent STOPPED
snmpd FATAL
start EXITED
supervisor-proc-exit-listener RUNNING
Work item tracking
Microsoft ADO (number only):
How I did it
Corrected syntax in the jinja template used to generate the snmpd.conf within the SNMP docker container.

How to verify it
sudo config snmpagentaddress add 1.1.1.1 -p 161 -v mgmt

docker exec -it snmp supervisorctl status | awk '{print $1, $2}'
dependent-startup EXITED
rsyslogd RUNNING
snmp-subagent RUNNING
snmpd RUNNING
start EXITED
supervisor-proc-exit-listener RUNNING
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #21987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants