Blogs

Can I set up filters for traps or informs?

By Erdem posted 02-01-2016 14:09

  

Question

Can I set up filters for traps or informs?

Answer

You can filter traps and informs based on the trap category and the object identifier. You can specify categories of traps to receive per host by using the categories statement at the [edit snmp trap-group trap-group] hierarchy level. Use this option when you want to monitor only specific modules of Junos OS.

 

The following example shows a sample configuration for receiving only link, vrrp-events, services, and otn-alarms traps:

 

[edit snmp]

trap-group jnpr {

 categories {

    link;

     vrrp-events;

     services;

     otn-alarms;

  }

  targets {

     192.168.69.179;

  }

}

 

Junos OS also has a more advanced filter option (notify-filter) for filtering specific traps or a group of traps based on their object identifiers.

 

The SNMPv3 configuration also supports filtering of SNMPv1 and SNMPv2 traps and excluding Juniper Networks enterprise-specific configuration management traps, as shown in the following configuration example:

 

[edit snmp]

v3 {

  vacm {

     security-to-group {

       security-model v2c {

         security-name sn_v2c_trap {

           group gr_v2c_trap;

         }

       }

     }

     access {

       group gr_v2c_trap {

         default-context-prefix {

           security-model v2c {

             security-level none {

              read-view all;

               notify-view all;

             }

           }

         }

       }

     }

  }

  target-address TA_v2c_trap {

     address 10.209.196.166;

     port 9001;

     tag-list tg1;

     target-parameters TP_v2c_trap;

  }

  target-parameters TP_v2c_trap {

     parameters {

       message-processing-model v2c;

       security-model v2c;

       security-level none;

       security-name sn_v2c_trap;

     }

     notify-filter nf1;

  }

  notify v2c_notify {

     type trap;

     tag tg1;

  }

  notify-filter nf1 {

     oid .1.3.6.1.4.1.2636.4.5 exclude;

     oid .1 include;

  }

  snmp-community index1 {

     community-name "$9$tDLl01h7Nbw2axN"; ## SECRET-DATA

     security-name sn_v2c_trap;

     tag tg1;

}

  view all {

   oid .1 include;

  }

}

 

For more information, click SNMP MIBs and Traps.


#FAQ
#JunosOS