01-02-2023 08:23 AM
Hi,
I have C899G-LTE-LA-K9 using simcard in cellular interface. I want the router to do modem-power-cycle every 180 second if the tunnel interface using this cellular link is down. Here's the idea i come up, I will create event manager to do modem power cycle if the tunnel is down, and there's another event manager to delete the event manager created for modem-power-cycle. But the problem is there's double quotation mark in the event manager script so it doesn't work. Is there anyway to achieve this? This is my script:
interface Cellular0
ip address negotiated
encapsulation slip
load-interval 30
dialer in-band
dialer idle-timeout 0
dialer string lte
dialer-group 1
no peer default ip address
end
interface Tunnel10
ip address 10.10.10.10 255.255.255.252
no ip redirects
ip mtu 1458
tunnel source 192.168.1.1
tunnel destination 172.16.10.1
end
ip route 172.16.10.1 255.255.255.255 Cellular0
event manager applet CELL_DOWN
event syslog pattern "Tunnel10, changed state to down"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "event manager applet MODEM_POWER_CYCLE"
action 4.0 cli command "event timer watchdog time 180"
action 5.0 cli command "action 1.0 cli command "test cellular 0 modem-power-cycle"" <---- This part doesn't work
action 6.0 cli command "action 2.0 cli command end"
action 7.0 cli command end
event manager applet DELETE_MODEM_POWER_CYCLE
event syslog pattern "Tunnel10, changed state to up"
action 1.0 cli command "enable"
action 2.0 cli command "configure terminal"
action 3.0 cli command "no event manager applet MODEM_POWER_CYCLE"
action 4.0 cli command end
Solved! Go to Solution.
01-03-2023 12:28 AM
Hello,
after some testing I have found the solution. Thank you for your reply.
track 300 interface Tunnel10 line-protocol
event manager applet CELL_DOWN
event timer watchdog time 180
action 10 cli command "enable"
action 20 syslog priority informational msg "CHECK TUNNEL STATUS"
action 30 cli command "show track 300"
action 40 regexp "Line protocol is ([A-Za-z0-9/\.:]+)" "$_cli_result" match intf
action 50 if $intf eq "Up" goto 90
action 60else if $intf eq "Down" goto 70
action 70 syslog priority informational msg "TUNNEL INTERFACE IS DOWN"
action 80 cli command "test cellular 0 modem-power-cycle"
action 90 cli command "end"
01-02-2023 08:44 AM - edited 01-02-2023 08:45 AM
let me understand what you like to do here.
when you see this syslog message "Tunnel10, changed state to down" then you run the command test cellular 0 modem-power-cycle
is this correct. you only get this message when the tunnel go down
So your EEM Script should be running event timer every 180 seconds of the condition logs tunnel down only it execute - test cellular 0 modem-power-cycle
event manager applet CELL_RESTART
event timer watchdog time 180
event syslog pattern "Tunnel10, changed state to down"
action 1.0 cli command "enable"
action 2.0 cli command "test cellular 0 modem-power-cycle"
action 3.0 syslog msg "EEM CELL_DOWN - CELLULAR Modem power cycled"
or if you looking different way : look below thread :
01-02-2023 10:28 AM
Hi, thanks for your response
yes that's correct, I want to execute command "test cellular 0 modem-power-cycle" every 180 seconds when the Tunnel is down.
@balaji.bandi wrote:event manager applet CELL_RESTART
event timer watchdog time 180
event syslog pattern "Tunnel10, changed state to down"
action 1.0 cli command "enable"
action 2.0 cli command "test cellular 0 modem-power-cycle"
action 3.0 syslog msg "EEM CELL_DOWN - CELLULAR Modem power cycled"
I tried this but looks like the router only accept 1 event condition, so I can't use "event timer watchdog time 180" and "event syslog pattern "Tunnel10, changed state to down"" in the same event manager applet.
I'm currently testing the solution in the link you provide
01-02-2023 11:23 AM
My router accepts all the EEM Scripts, can you post the show version and also what error it is throwing when you add that commands?
but the EEM Script automatically triggers as soon it see the SYSLOG pattern
event manager applet CELL_RESTART
event syslog pattern "Tunnel10, changed state to down"
action 1.0 cli command "enable"
action 2.0 cli command "test cellular 0 modem-power-cycle"
action 3.0 syslog msg "EEM CELL_DOWN - CELLULAR Modem power cycled"
01-02-2023 11:27 AM
Hello,
what you probably want is this:
event manager applet CELL_DOWN
event syslog pattern "Tunnel10, changed state to down" maxrun 180
action 1.0 cli command "enable"
action 5.0 cli command ""test cellular 0 modem-power-cycle"
On a side note, make sure you have 'service internal' configured on your router...as far as I recall, the 'test cellular' command is a hidden command...
C899G(config)#service internal
01-03-2023 12:28 AM
Hello,
after some testing I have found the solution. Thank you for your reply.
track 300 interface Tunnel10 line-protocol
event manager applet CELL_DOWN
event timer watchdog time 180
action 10 cli command "enable"
action 20 syslog priority informational msg "CHECK TUNNEL STATUS"
action 30 cli command "show track 300"
action 40 regexp "Line protocol is ([A-Za-z0-9/\.:]+)" "$_cli_result" match intf
action 50 if $intf eq "Up" goto 90
action 60else if $intf eq "Down" goto 70
action 70 syslog priority informational msg "TUNNEL INTERFACE IS DOWN"
action 80 cli command "test cellular 0 modem-power-cycle"
action 90 cli command "end"
01-03-2023 03:55 AM
Tthank you for sharing your working solution with cisco community this will help other members who looking to solve the same issue.
I am sure you learned with good exmples around and able to fix the issue.
appriciated your input.
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