示例:使用正则表达式控制事件策略
只有当两个陷阱(SNMP_TRAP_LINK_DOWN
和)中的属性彼此interface-name
匹配且陷阱中的SNMP_TRAP_LINK_DOWN
属性以字母t开头时interface-name
,才执行以下SNMP_TRAP_LINK_UP
策略。这意味着策略仅对 T1 (t1-) 和 T3 (t3-) 接口执行。当进程接收来自其他接口的陷阱时,eventd
策略不会执行。
注意:
在系统日志文件中,消息标记出现在所有大写字母中。在命令行界面 (CLI) 中,消息标记显示在所有小写字母中。
[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; } } }