Description

This article provides information on how to generate a SNMP trap for any syslog message on EX switches and other Junos platforms.

Symptoms

  • The customer's network management system (NMS) uses traps, rather than system log messages to monitor network activity.
  • A syslog message has to be administratively sent to the network management server.
  • There may be some syslog entries with critical severity, which are not sent to the SNMP trap server.

Solution

  • Configuring event policies to raise SNMP traps :

    You can convert any syslog message into a trap by using the event-options statement. The following example illustrates how to configure a jnxSyslogTrap ,   whenever an rpd_ldp_nbrdown syslog error message occurs:
    user@host> show event-options
        policy snmptrap {
            events rpd_ldp_nbrdown;
            then {
                raise-trap;
            }
        }
  • Spoofing enterprise specific SNMP traps :

    You can use the request snmp spoof-trap operational mode command to mimic SNMP trap behavior. The contents of the traps (the values and instances of the objects carried in the trap) can be specified on the command line or automatically spoofed. This feature is useful to trigger SNMP traps from routers and ensure that they are processed correctly within your existing network management infrastructure; but you might find it difficult to simulate the error conditions that trigger many of the traps on the switch. This is also useful for testing and debugging SNMP behavior on the switch or NMS.

    The request snmp spoof-trap trap <name> command is for simulating a trap to the NMS, which normally receives the device’s traps. You can also add required values by using the variable-bindings parameter. For more information, refer to the following link:

    http://www.juniper.net/techpubs/en_US/junos/topics/reference/general/snmp-junos-faq.html#snmp-traps-informs-faq%20-

    On the above link, specifically refer to the SNMP Traps and Informs FAQs section for the following example:

    "A Junos operations (op) script is triggered when a UI_COMMIT_NOT_CONFIRMED event is received. The Junos OP script matches the complete message of the event and generates an SNMP trap" .

Modification History

2020-06-25: Article reviewed for accuracy; no changes required, article valid

Related Information