Setting Up SNMP Traps

Problem

You want to create triggers on the router to send unsolicited notifications to the NMS system when a router event occurs.

Solution

Configure traps by setting up SNMP trap groups:

[edit snmp] aviva@router1# set trap-group authentication-traps targets 10.0.10.1 aviva@router1# set trap-group authentication-traps targets 192.168.15.27 aviva@router1# set trap-group authentication-traps categories authentication

 

Discussion

SNMP traps report significant events that occur on the router, commonly errors or failures. You always want the SNMP agent to send traps to the manager so that the manager receives current information without always having to poll for it. To have the router send traps to the SNMP manager, create one or more trap groups. For each group, set two things: the IP address of the NMS server (or servers) to receive the trap and the events that trigger the traps. The targets statement identifies the receiving NMS systems, and the categories statement specifies the triggering event or events (see Table 4-1). The JUNOS software supports standard trap categories and provides several that are enterprise-specific. This recipe sends a trap to two NMS systems (our primary system and a backup one for redundancy) whenever an SNMP manager uses the incorrect community to access data held by the agent.

Table 4-1. SNMP trap categories

Keyword

Type

Category description

authentication

Standard

Agent (router) authentication failures

chassis

Enterprise

Chassis and router environment notifications

configuration

Enterprise

Configuration mode notifications

link

Enterprise

Link-related transitions, such as when hardware transitions from up to down, or vice versa

rmon-alarm

Enterprise

RMON event alarms

routing

Enterprise

Routing protocol notifications

sonet-alarms alarm-name

Enterprise

SONET alarm notifications

startup

Standard

Router warm and full reboots

vrrp-events

Enterprise

VRRP events

SNMP traps are defined in the MIBs themselves. The IETF defines the standard traps in various RFCs, and they are normally compiled into the SNMP manager software that runs on the NMS system. Juniper Networks defines enterprise-specific traps for SNMPv1 and SNMPv2 and sends both versions of the traps to the NMS. To find a list and an explanation of the JUNOS traps, look in the enterprise MIBs, searching for the string NOTIFICATION-TYPE in the MIB. For example, in the Juniper Networks chassis MIB, the OID for the trap that reports the failure of a power supply, jnxPowerSupplyFailure, is jnxChassisTraps 1:

-- definition of chassis related traps Traps for chassis alarm conditions jnxPowerSupplyFailure NOTIFICATION-TYP OBJECTS… STATUS current DESCRIPTION "A jnxPowerSupplyFailure trap signifies that the SNMP entity, acting in an agent role, has detected that the specified power supply in the chassis has been in the failure (bad DC output) condition." ::= { jnxChassisTraps 1 }

Категории