changes to handle snmp configuration as per the modified CLI#3586
changes to handle snmp configuration as per the modified CLI#3586lguohan merged 1 commit intosonic-net:masterfrom kannankvs:management_vrf_snmp_support2
Conversation
|
Hi @kannankvs, In your PR, for example, Could you optimize code and submit another PR? #Closed |
| fi | ||
|
|
||
| echo -n "" > /tmp/snmpagentaddr.yml | ||
| keys=`/usr/bin/redis-cli -n 4 keys "SNMP_AGENT_ADDRESS_CONFIG|*"` |
There was a problem hiding this comment.
/usr/bin/redis-cli -n 4 keys "SNMP_AGENT_ADDRESS_CONFIG|*" [](start = 10, length = 58)
Try prevent usage redis-cli keys * because if will join keys by blanks without escaping. #Closed
There was a problem hiding this comment.
@qiluo-msft : These lines are not needed with the new PR4057 and hence the comment is ignored.
@qiluo-msft : A new PR4057 has been raised to address the same. Request you to kindly review it and provide the comments. |
While doing CLI changes for SNMP configuration, few changes are made in backend to handle the modified CLI.
** Changes**
Testing Done
Tested by configuring the SNMP listening IP as well as the trap server IP.
admin@sonic:
$ sudo config vrf add mgmt$ sudo config snmpagentaddress add 100.104.45.9 -v mgmtadmin@sonic:
admin@sonic:
$ sudo config snmptrap modify 3 100.94.212.7 -v mgmt$ sudo cat /etc/sonic/snmp.ymladmin@sonic:
snmp_rocommunity: public
snmp_location: public
v1_trap_dest: NotConfigured
v2_trap_dest: NotConfigured
v3_trap_dest: 100.94.212.7:162%mgmt public
snmp_agent_address_1: 100.104.45.9%mgmt
root@sonic:~# docker exec -it snmp bash
The file /etc/snmp/snmpd.conf inside snmp docker shows the following configuration which will be used by snmpd daemon.
Following %mgmt will be used by snmpd to listen to the IP 100.104.45.9 in "mgmt" vrf.
agentAddress 100.104.45.9%mgmt
Following %mgmt will be used by snmpd to send traps to the server 100.94.212.7 in "mgmt" vrf.
informsink 100.94.212.7:162%mgmt public