cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1402
Views
3
Helpful
5
Replies

Restart 4G module

quadrabe
Level 1
Level 1

Hi

Every now and then we have a router that goes offline because of its 4G module.
What we do now is physically go to the router and put in a reload.
Is there a way to automatically restart only the 4G module whenever the router detects that it has no more 4G?

1 Accepted Solution

Accepted Solutions

Hello,

the script needs a few changes (such as the maxrun timer, as by default it will run for 20 seconds). You also need to match on syslog pattern. You also need  to get into 'enable' mode.

The below should work:

event manager applet restart_4g
event syslog pattern " %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0/2/0, changed state to down" maxrun 180
action 1 cli command "enable"
action 2 wait 60
action 3 cli command "show interface Cellular0/2/0 | include line protocol"
action 4 regexp "line protocol is (\\w+)" "$_cli_result" match state
action 5 if $_regexp_result eq "up"
action 6 syslog msg "Cellular0/2/0 is back up, no action needed"
action 7 else
action 8 syslog msg "Cellular0/2/0 is still down, executing script"
action 9 cli command "config t"
action 9.1 cli command "interface Cellular0/2/0"
action 9.2 cli command "shut"
action 9.3 wait 5
action 9.4 cli command "no shutdown"
action 9.5 cli command "end"
action 9.6 syslog msg "Cellular0/2/0 has been restarted"
action 9.7 end

View solution in original post

5 Replies 5

balaji.bandi
Hall of Fame
Hall of Fame

You need to provide some informatiom,what model of the router and what IOS code running to help better.

other suggestions : (users reported that below command fix the issue)

ROUTER# test cellular 0/2/0 modem-power-cycle
ROUTER# test cellular 0/2/0 modem-reset

You can also use EEM Script if the router not able to reach internet with ping and wait for 2 fails or 3 fails you can restart modem

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

I wrote this real quick, we'll have to do some testing to see if it works correctly.




event manager applet restart_4g

event track 1 state down

action 1 syslog msg "Cellular0/2/0 is down, waiting for 60 seconds in case it comes back up"

action 2 wait 60

action 3 cli command "show interface Cellular0/2/0 | include line protocol"

action 4 regexp "line protocol is (\\w+)" "$_cli_result" match state

action 5 if $_regexp_result eq "up"

action 6     syslog msg "Cellular0/2/0 is back up, no action needed"

action 7 else

action 8     syslog msg "Cellular0/2/0 is still down, executing script"

action 9     cli command "config t"

action 10    cli command "interface ce0/2/0"

action 11    cli command "shut"

action 12    wait 5

action 13    cli command "no shutdown"

action 14    cli command "end"

action 15    syslog msg "Cellular0/2/0 has been restarted"

action 16    end

action 17 end



Sure that is way to go, try manually that command works , then use EEM to automate.

EEM script, make sure your syslog message matched as you mentioned -  may be not the case you get lot, you get only down log, so adjust based on the requirement.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hello,

the script needs a few changes (such as the maxrun timer, as by default it will run for 20 seconds). You also need to match on syslog pattern. You also need  to get into 'enable' mode.

The below should work:

event manager applet restart_4g
event syslog pattern " %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0/2/0, changed state to down" maxrun 180
action 1 cli command "enable"
action 2 wait 60
action 3 cli command "show interface Cellular0/2/0 | include line protocol"
action 4 regexp "line protocol is (\\w+)" "$_cli_result" match state
action 5 if $_regexp_result eq "up"
action 6 syslog msg "Cellular0/2/0 is back up, no action needed"
action 7 else
action 8 syslog msg "Cellular0/2/0 is still down, executing script"
action 9 cli command "config t"
action 9.1 cli command "interface Cellular0/2/0"
action 9.2 cli command "shut"
action 9.3 wait 5
action 9.4 cli command "no shutdown"
action 9.5 cli command "end"
action 9.6 syslog msg "Cellular0/2/0 has been restarted"
action 9.7 end

I've modified it a little more but this works!

event manager applet restart_4g

event syslog pattern " %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0/2/0, changed state to down" maxrun 180

action 1.0 syslog msg "Cellular0/2/0 is down, waiting for 60 seconds in case it comes back up"

action 1.1 wait 60

action 2 cli command "enable"

action 3 cli command "show interface Cellular0/2/0 | include line protocol"

action 4 regexp "line protocol is (\\w+)" "$_cli_result" match state

action 5 if $state eq "up"

action 6 syslog msg "Cellular0/2/0 is back up, no action needed"

action 7 else

action 8 syslog msg "Cellular0/2/0 is still down, executing script"

action 9 cli command "config t"

action 9.1 cli command "interface Cellular0/2/0"

action 9.2 cli command "shut"

action 9.3 wait 5

action 9.4 cli command "no shutdown"

action 9.5 cli command "end"

action 9.6 syslog msg "Cellular0/2/0 has been restarted"

action 9.7 end


 

Review Cisco Networking for a $25 gift card