Configuring the SNMP agent to send notifications to a host

You can configure the SNMP agent to send notifications as traps or informs to a host, typically an NMS, for analysis and management. Traps are less reliable and use fewer resources than informs, because an NMS does not send an acknowledgment when it receives a trap.

Configuration guidelines

When network congestion occurs or the destination is not reachable, the SNMP agent buffers notifications in a queue. You can set the queue size and the notification lifetime (the maximum time that a notification can stay in the queue). A notification is deleted when its lifetime expires. When the notification queue is full, the oldest notifications are automatically deleted.

You can extend standard linkUp/linkDown notifications to include interface description and interface type, but must make sure the NMS supports the extended SNMP messages.

To send informs, make sure of the following information:

Configuration prerequisites

Configure the SNMP agent with the same basic SNMP settings as the NMS. If SNMPv1 or SNMPv2c is used, you must configure a community name. If SNMPv3 is used, you must configure an SNMPv3 user, a MIB view, and a remote SNMP engine ID associated with the SNMPv3 user for notifications.

Make sure the SNMP agent and the NMS can reach each other.

Configuration procedure

To configure the SNMP agent to send notifications to a host:

Step

Command

Remarks

1. Enter system view.

system-view

N/A

2. Configure a target host.

  • (In non-FIPS mode.) Send traps to the target host:snmp-agent target-host trap address udp-domain { ipv4-address | ipv6 ipv6-address } [ udp-port port-number ] [ vpn-instance vpn-instance-name ] params securityname security-string [ v1 | v2c | v3 [ authentication | privacy ] ]

  • (In FIPS mode.) Send traps to the target host:snmp-agent target-host trap address udp-domain { ipv4-address | ipv6 ipv6-address } [ udp-port port-number ] [ vpn-instance vpn-instance-name ] params securityname security-string v3 { authentication | privacy }

  • (In non-FIPS mode.) Send informs to the target host:snmp-agent target-host inform address udp-domain { ipv4-address | ipv6 ipv6-address } [ udp-port port-number ] [ vpn-instance vpn-instance-name ] params securityname security-string { v2c | v3 [ authentication | privacy ] }

  • (In FIPS mode.) Send informs to the target host:snmp-agent target-host inform address udp-domain { ipv4-address | ipv6 ipv6-address } [ udp-port port-number ] [ vpn-instance vpn-instance-name ] params securityname security-string v3 { authentication | privacy }

By default, no target host is configured.

3. (Optional.) Configure a source address for notifications.

snmp-agent { inform | trap } source interface-type { interface-number | interface-number.subnumber }

By default, SNMP uses the IP address of the outgoing routed interface as the source IP address.

4. (Optional.) Enable extended linkUp/linkDown notifications.

snmp-agent trap if-mib link extended

By default, the SNMP agent sends standard linkup/linkDown notifications.

5. (Optional.) Set the notification queue size.

snmp-agent trap queue-size size

By default, the notification queue can hold 100 notification messages.

6. (Optional.) Set the notification lifetime.

snmp-agent trap life seconds

The default notification lifetime is 120 seconds.