< Home

Example for Outputting Traps to the SNMP Agent

Networking Requirements

As shown in Figure 1, SwitchA connects to the NMS station. There is a reachable route between SwitchA and the NMS station. The network administrator wants to view traps of ARP module generated by SwitchA on the NMS station to monitor device running and locate faults.

Figure 1 Networking diagram for outputting traps to the SNMP agent

Configuration Roadmap

The configuration roadmap is as follows:

  1. Enable the information center.

  2. Configure a channel and a rule for outputting traps to the SNMP agent so that the SNMP agent can receive traps generated by SwitchA.

  3. Configure SwitchA to output traps to the NMS station so that the NMS station can receive traps generated by SwitchA.

Procedure

  1. Enable the information center.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] info-center enable
    

  2. Configure a channel and a rule for outputting traps to the SNMP agent.

    # Configure a channel for outputting traps to the SNMP agent.

    [SwitchA] info-center snmp channel channel7
    

    # Configure a rule for outputting traps to the SNMP agent.

    [SwitchA] info-center source arp channel channel7 trap level informational state on 

    By default, the device uses the SNMP agent to output traps of all modules.

  3. Configure an IP address for the interface used to send trap messages.

    [SwitchA] vlan batch 2
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type trunk
    [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface vlanif 2
    [SwitchA-Vlanif2] ip address 10.1.1.2 24
    [SwitchA-Vlanif2] quit

  4. Configure the SNMP agent to output traps to the NMS station.

    # Enable the SNMP agent and set the SNMP version to SNMPv2c.

    [SwitchA] snmp-agent sys-info version v2c
    

    # Configure a community name.

    [SwitchA] snmp-agent community write adminnms1
    

    # Configure the trap function.

    [SwitchA] snmp-agent trap enable
    Warning: All switches of SNMP trap/notification will be open. Continue? [Y/N]:y
    [SwitchA] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname public v2c
    [SwitchA] quit

  5. Verify the configuration.

    # View the channel used by the SNMP agent to output traps.

    <SwitchA> display info-center
    Information Center:enabled
    Log host:
    Console:
            channel number : 0, channel name : console
    Monitor:
            channel number : 1, channel name : monitor
    SNMP Agent:
            channel number : 7, channel name : channel7
    Log buffer:
            enabled,max buffer size 1024, current buffer size 512,
    current messages 512, channel number : 4, channel name : logbuffer
    dropped messages 0, overwritten messages 37
    Trap buffer:
            enabled,max buffer size 1024, current buffer size 256,
    current messages 185, channel number:3, channel name:trapbuffer
    dropped messages 0, overwritten messages 0
    logfile:
            channel number : 9, channel name : channel9, language : English  
    Information timestamp setting:
            log - date, trap - date, debug - date millisecond
    
     Sent messages = 273514, Received messages = 284905
    
     IO Reg messages = 2 IO Sent messages = 11392
    

    # View traps output through the channel used by the SNMP agent.

    <SwitchA> display channel 7
    channel number:7, channel name:channel7
    MODU_ID  NAME     ENABLE LOG_LEVEL     ENABLE TRAP_LEVEL    ENABLE DEBUG_LEVEL
    ffff0000 default  Y      debugging     Y      debugging     N      debugging
    416e0000 ARP      Y      debugging     Y      informational N      debugging
    

    # View traps output to the NMS station by the SNMP agent.

    <SwitchA> display snmp-agent target-host
    Target-host NO. 1
    -----------------------------------------------------------
      IP-address    : 10.1.1.1
      Domain        : -
      Source interface : -
      VPN instance  : -
      Security name : %^%#uq/!YZfvW4*vf[~C|.:Cl}UqS(vXd#wwqR~5M(rU%%^%#
      Port          : 162
      Type          : trap
      Version       : v2c
      Level         : No authentication and privacy
      NMS type      : NMS
      With ext-vb   : No
    -----------------------------------------------------------
    

Configuration Files

SwitchA configuration file

#
sysname SwitchA
# 
info-center source ARP channel 7 trap level informational
info-center snmp channel 7
#
vlan batch 2
#
interface Vlanif2
 ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2
#
snmp-agent
snmp-agent local-engineid 000007DB7FFFFFFF00003B4C
snmp-agent community write cipher %^%#.T|&Whvyf$<Gd"I,wXi5SP_6~Nakk6<<+3H:N-h@aJ6d,l0md%HCeAY8~>X=>xV\JKNAL=124r839v<*%^%#
snmp-agent sys-info version v2c v3
snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname cipher %^%#uq/!YZfvW4*vf[~C|.:Cl}UqS(vXd#wwqR~5M(rU%%^%# v2c
snmp-agent trap enable
#
return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >