Blog Viewer

How To: Generate SNMP Traps from System Alarms

By Erdem posted 04-06-2016 11:51

  

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:


#FAQ
#SNMP
#DayOne

Permalink