Navigation
Supported Platforms
Example: Controlling Event Policy Using a Regular Expression
The following policy is executed only if the interface-name attribute in both traps (SNMP_TRAP_LINK_DOWN and SNMP_TRAP_LINK_UP) match each other and the interface-name attribute in the SNMP_TRAP_LINK_DOWN trap starts with letter t. This means the policy is executed only for T1 (t1-) and T3 (t3-) interfaces. The policy is not executed when the eventd process receives traps from other interfaces.
![]() | Note: In system log files, the message tags appear in all uppercase letters. In the command-line interface (CLI), the message tags appear in all lowercase letters. |
[edit event-options]
policy pol6 {events snmp_trap_link_down;within 120 events snmp_trap_link_up;attributes-match {snmp_trap_link_up.interface-name equals snmp_trap_link_down.interface-name;snmp_trap_link_down.interface-name matches "^t";}then {execute-commands {commands {"show interfaces {$$.interface-name}";"show configuration interfaces {$$.interface-name}";}output-filename config.txt;destination bsd2;output-format text;}}}