08-05-2025 10:13 AM
We currently use the following script to reset the PRI when it fails. This works fine, but sometimes generate dozens of alerts when the link is flapping. I am trying to build a script that won't generate more than one email every five minutes. Here is the current working script: event manager applet serial_interface_reset authorization bypass event syslog pattern "%ISDN-6-LAYER2DOWN:" maxrun 180 trigger delay 25 action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "int Serial0/1/1:23" action 3.1 cli command "shutdown" action 3.2 wait 10 action 3.3 cli command "controller T1 0/1/1" action 3.4 cli command "shutdown" action 4.0 wait 10 action 4.1 cli command "no shutdown" action 4.2 cli command "int Serial0/1/1:23" action 5.0 wait 10 action 5.1 cli command "no shutdown" action 5.2 wait 10 action 5.3 cli command "no network-clock synchronization automatic" action 5.4 cli command "network-clock synchronization automatic" action 6.0 cli command "end" action 7.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Site on Router Name ISDN-6-LAYER2DOWN:" body "PRI Failure Detected and Reset - call Site and if unreachable, open a HIGH priority ticket with the network team!" action 8.0 syslog msg "ISDN-6-LAYER2DOWN - EMail Sent to VTOC Group" Here is what I have tested, but can't get it to work:
event manager applet serial_interface_reset authorization bypass event syslog pattern "%ISDN-6-LAYER2DOWN:" maxrun 180 trigger delay 25 action 0.1 cli command "dir bootflash:layer2down.flag" action 0.2 regexp "No such file" "$_cli_result" _no_file action 0.3 if $_no_file eq 1 action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "int Serial0/1/1:23" action 3.1 cli command "shutdown" action 3.2 wait 10 action 3.3 cli command "controller T1 0/1/1" action 3.4 cli command "shutdown" action 4.0 wait 10 action 4.1 cli command "no shutdown" action 4.2 cli command "int Serial0/1/1:23" action 4.3 cli command "no shutdown" action 5.0 wait 10 action 5.2 cli command "no network-clock synchronization automatic" action 5.3 cli command "network-clock synchronization automatic" action 6.0 cli command "end" action 7.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Site on Router Name ISDN-6-LAYER2DOWN:" body "PRI Failure Detected and Reset - call Site and if unreachable, open a HIGH priority ticket with the network team!" action 8.0 syslog msg "ISDN-6-LAYER2DOWN - Email Sent to VTOC Group" ! Create a flag file by appending to an existing one or creating new action 9.0 cli command "copy null: flash:layer2down.flag" action 9.1 end event manager applet reset_email_flag event timer watchdog time 300 action 1.0 cli command "delete /force flash:layer2down.flag"
08-05-2025 12:27 PM
Just to understand the Script working, but you getting too many emails and you like to cut-down sending email every 5min ?
08-06-2025 06:47 AM
Yes, that's correct.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide