Network Management
Network Management

How To: Generate SNMP Traps from System Alarms

by Juniper Employee on ‎04-06-2016 11:51 AM - edited on ‎10-04-2017 03:38 PM by Administrator Administrator (1,861 Views)

Overview

Generate SNMP traps from syslog events.

 

Description

Not all Juniper Junos OS alarms automatically generate SNMP notifications (traps or informs). You can generate  SNMP notifications for syslog events by using the event-options and raise-trap CLI statements in an event policy.

Example Configuration

 

An ESX switch has a warm temperature event occur, which causes an amber system alarm and the following syslog messages:

 

Mar 2 11:04:41 switch2 alarmd[1329]: Alarm set: FPC color=YELLOW, class=CHASSIS, reason=FPC 3 EX-PFE2 Temp Too Warm
Mar 2 11:04:41 switch2 craftd[1330]: Minor alarm set, FPC 3 EX-PFE2 Temp Too Warm
Mar 2 11:07:29 switch2 craftd[1330]: Minor alarm cleared, FPC 3 EX-PFE2 Temp Too Warm
Mar 2 11:07:29 switch2 alarmd[1329]: Alarm cleared: FPC color=YELLOW, class=CHASSIS, reason=FPC 3 EX-PFE2 Temp Too Warm

 

 

The following configuration sends SNMP traps for those syslog alarm messages:

 

event-options {
   policy alarms {
     events SYSTEM;
     attributes-match {
       system.message matches "alarm set";
     }
     then {
       raise-trap;
    }
  }
}

 

NOTE: This example assumes you have already configured your system to generate SNMP notifications.

 

Further Reading

You can find out more about event policies from the following resources: