The snmp-agent target-host trap command configures the target host for receiving SNMP traps.
The undo snmp-agent target-host command deletes the target host configuration for receiving SNMP traps.
By default, the target host is not set.
snmp-agent target-host trap address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ public-net | vpn-instance vpn-instance-name ] ] * params securityname security-name [ [ v1 | v2c | v3 [ authentication | privacy ] ] | private-netmanager | notify-filter-profile profile-name | ext-vb ] *
snmp-agent target-host trap address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ public-net | vpn-instance vpn-instance-name ] ] * params securityname cipher security-name [ [ v1 | v2c ] | private-netmanager | notify-filter-profile profile-name | ext-vb ] *
undo snmp-agent target-host ip-address securityname { security-name | cipher security-name } [ vpn-instance vpn-instance-name ]
undo snmp-agent target-host trap address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ public-net | vpn-instance vpn-instance-name ] ] * params securityname { security-name | cipher security-name }
Parameter | Description | Value |
---|---|---|
address |
Specifies the IP address of a specified target host. |
- |
udp-domain ip-address |
Specifies the IP address of a specified target host, with the transmission domain being based on UDP. |
- |
udp-port port-number |
Specifies the UDP port of the specified target host for receiving Trap messages. |
The value is an integer ranging from 0 to 65535. The default value is 162. |
source interface-type interface-number |
Specifies the source interface of the device for sending Trap messages. |
- |
public-net |
Specifies VPN instance to which the target host belongs. |
- |
vpn-instance vpn-instance-name |
Indicates the target host is on the public network. |
The value must be an existing VPN instance name. |
params securityname security-name |
Specifies the user security name displayed on the NMS. For SNMPv3, securityname must be configured as the user name. securityname configured on the host needs to be the same as that configured on the NMS, or the NMS cannot receive the trap messages sent from the host. Ensure that the security-name value is the same as the created user name; otherwise, the NMS cannot access the device. For SNMPv1 and SNMPv2c, the NMS can receive trap messages from all hosts without having securityname configured. securityname is used to distinguish multiple hosts that generate trap messages. |
The value is a string of 1 to 32 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
cipher security-name |
Indicates the unencrypted or encrypted string of security name. |
The value is a string of 1 to 32 case-sensitive characters or a string of 32, 48, 56, or 68 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.
|
v1 | v2c | v3 |
Indicates the SNMP version.
If this parameter is not specified, the default version is SNMPv1. |
- |
authentication | privacy |
Specifies the security mode.
This parameter takes effect only in SNMPv3. |
- |
private-netmanager |
Indicates the Huawei NMS as the target host receiving a trap. When a Huawei NMS is deployed and this parameter is configured, a trap sent to the NMS contains more information, such as the trap type, sequence of the trap, and sending time. |
- |
notify-filter-profile profile-name |
Specifies the filtering view name. If the trap filtering is not configured using the parameter notify-filter-profile, all traps will be sent to the destination host. |
The value is a string of 1 to 32 case-sensitive characters, spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
ext-vb |
Indicates that traps sent to a target host carry extended bound variables. If a Huawei data communication device extends the trap objects defined in the public MIB, you can configure this parameter to determine whether traps sent to the NMS carry extended bound variables.
|
- |
Usage Scenario
SNMP notifications can be classified into traps and inform messages. Trap messages are less reliable than inform messages because the NMS does not send any acknowledgment when it receives a trap. In this case, the sender cannot verify whether the trap has been received. Informs are configured with an acknowledgment mechanism and therefore are reliable.
To configure multiple target hosts, you must run the snmp-agent target-host trap command on each target host. If you run the snmp-agent target-host trap command for multiple times on a host, only the latest configuration takes effect. For example, if you configure the trap function for a host that has been configured with trap, the second configuration takes effect.
Configuration Impact
No matter whether a trap sent from the SNMP agent reaches the NMS, the SNMP agent deletes the trap to reduce the resource consumption.
Precautions
If the SNMP trap function has been enabled, to ensure that SNMPv3-running devices normally send trap messages, notify-view notify-view must be configured in the snmp-agent group command for the user group to which securityname belongs to allow the devices to have the right to send trap messages.
For SNMPv1 and SNMPv2c, when a user with a level lower than the level configured using this command queries the securityname configured using the display this command, the securityname is displayed as asterisks (******).
# Allow the SNMP agent to send SNMP traps to the target host with the IP address of 10.1.1.1.
<HUAWEI> system-view [HUAWEI] snmp-agent trap enable [HUAWEI] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname comaccess
# Allow the SNMP agent to send SNMP traps to the Huawei NMS with the IP address of 10.1.1.1.
<HUAWEI> system-view [HUAWEI] snmp-agent trap enable [HUAWEI] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname comaccess private-netmanager