Skip to content
Ask AI

SNMP Configuration

[Command] show snmp-agent trap-target

[Purpose] Display SNMP trap server configuration

[View] System view

[Use Cases]

sonic# show snmp-agent trap-target
Version TrapReceiverIP Port VRF Community User
--------- ---------------- ------ ----- ----------- ------
2 1.1.1.1 162 None testa -

[Command] show snmp-agent source

[Purpose] Display the SNMP source address and port configuration

[View] System view

[Use Cases]

sonic# show snmp-agent source
ListenIP ListenPort ListenVrf
---------- ------------ -----------
30.11.0.82

[Command] show snmp-agent user

[Purpose] Display SNMPv3 user configuration

[View] System view

[Use Cases]

sonic# show snmp-agent user
User Type AuthType EncryptionType
------ ------------ ---------- ----------------
test noAuthNoPriv

[Command] show snmp-agent threshold

[Purpose] Display SNMP alarm threshold configuration

[View] System view

[Use Cases]

sonic# show snmp-agent threshold
Threshold-Type Threshold-Value
---------------- -----------------
cpu-usage 80%
memory-usage 80%

[Command] snmp-agent enable no snmp-agent enable

[Purpose] Enable SNMP function

[View] System configure view

[Use Cases]

sonic(config)# snmp-agent enable

[Command] snmp-agent community community_name no snme-agent community community_name

[Purpose] Add SNMP community

[Parameter]

ParameterDescription
community_namecommunity name

[View] System configuration view

[Usage Scenario] The community name like a password, and devices within the community use this name for authentication during communication. Only devices with the same configured community name can access each other. By default, the community name is set to public.

[Use Cases]

sonic(config)# snmp-agent community snmptest

[Command] snmp-agent user name AuthNoPriv {MD5|SHA} password snmp-agent user name Priv {MD5|SHA} {DES|AES} password snmp-agent user name noAuthNoPriv no snmp-agent user name

[Purpose] Create SNMPv3 users

[Parameter]

ParameterDescription
nameUser name
AuthNoPrivSpecify the security level as requiring authentication, and specify the authentication method as: MD5/SHA
noAuthNoPrivSpecify the security level as no authentication required
Priv {MD5|SHA}Specify the security level as encryption
{DES|AES}Specify the encryption algorithm

[View] System configuration view

[Usage Scenario] SNMPv3 provides encryption and authentication mechanisms to safeguard the management information of network devices from unauthorized access. Therefore, in high-security network environments, using SNMPv3 can better protect the security of network devices.

[Use Cases]

sonic(config)# snmp-agent user user3 priv md5 12345678 des 87654321
sonic(config)# snmp-agent user user4 noauthnopriv
sonic(config)# snmp-agent user user5 authnopriv md5 12345678

snmp-agent trap-target threshold system-usage

Section titled “snmp-agent trap-target threshold system-usage”

[Command] snmp-agent trap-target threshold {reset|system-usage} {cpu-usage|memory-usage} value snmp-agent trap-target threshold reset system-usage

[Purpose] Enable specific utilization alarm switch

[Parameter]

ParameterDescription
cpu-usageCPU utilization
memory-usageMemory Utilization
valueAlarm Threshold

[View] System configuration view

[Use Cases]

sonic(config)# snmp-agent trap-target threshold system-usage memory-usage 70

[Command] snmp-agent trap-target {1|2|3} address [udp-port portname ] [vrf vrfname ] [community community_name ] no snmp-agent trap-target {1|2|3}

[Purpose] Configure the server for agent trap

[Parameter]

ParameterDescription
addressIP address
portnumPort number, default 162
vrfnamevrf name
nameagent community

[View] System configuration view

[Usage Scenario] Devices send alarm messages that can be uploaded to a trap server using the trap command. In this case, the SNMP trap server needs to be configured. However, the reliability of trap messages is lower because the sender cannot confirm whether the trap message has been received, as the recipient does not send acknowledgment messages.

[Use Cases]

sonic# configure terminal
sonic(config)# snmp-agent trap-target v1 10.250.0.221
sonic(config)# snmp-agent trap-target v2c 10.250.0.221 udp-port 163 community comm1

[Command] snmp-agent source { A.B.C.D/A::B|interface_name|loopback} [udp-port portnum |vrf vrf_name ]

[Purpose] Configure the source IP address of the device to send SNMP protocol packets

[Parameter]

ParameterDescription
A.B.C.D/A::BIP address
Interface_nameinterface name ,can only be configured as Loopback0
loopbackLoopback
portnumThe port number, default is 161

[View] System configuration view

[Use Cases]

sonic# configure terminal
sonic(config)# snmp-agent source 10.250.0.221