cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1234
Views
0
Helpful
3
Replies

3/4G-CHECK Script

support_user10
Level 1
Level 1

Hi,

 

I need some help with creating an eem applet to check 3/4G every month.

I've two challenges to face:

 

1) The check has to be done once a month and because we must check this on multiple routers it may/can not run on the same time due to heavy load.

2) Within the script I need to know first if the Cel interface is already up. If so then don't shutdown.

If the Cel interface is down and the check has been done it needs to be shutdown,

 

I've come up to this till now:

event manager applet 3/4G-CHECK authorization bypass
event none
 action 10.00   info type routername
 action 10.01   cli command "enable"
 action 10.02   cli command "show configuration lock"
 action 10.03   regexp " not " "$_cli_result" result
 action 10.04   if $_regexp_result eq "0"
 action 10.05   cli command "clear configuration lock" pattern "[confirm]"
 action 10.06   cli command "y"
 action 10.07   end
 action 10.08   cli command "sh ip int brief | incl Cellular"
 action 10.09   regexp "down" "$_cli_result"
 action 10.10   if $_regexp_result eq "1"
 action 10.11   cli command "configure terminal"
 action 20.01   cli command "cgios-intcel"
 action 20.02   cli command "no shutdown"
 action 20.03   cli command "end"
 action 20.04   wait 60
 action 20.05   cli command "ping vrf outside-mobile 8.8.8.8"
 action 20.06   regexp "!!!!!" "$_cli_result"
 action 20.07   if $_regexp_result eq "1"
 action 20.08   syslog msg "$_info_routername 3/4G OK"
 action 20.09   else
 action 20.10   syslog msg "$_info_routername 3/4G not OK, please check"
 action 95.01   end
 action 95.02   end

Any help would be appreciated.

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Since EEM is device-embedded and it doesn't look like your applet requires external resources, you can just use cron to schedule the applet to run at times that are good for each device.  For example to run once a month at midnight on the first:

 

event timer cron cron-entry "0 0 1 * *"

 

For action 10.05, I would have:

action 10.05   cli command "clear configuration lock" pattern "confirm"

 

Finally, I'd add "maxrun 90" to the end of the event statement to handle your wait.

Joseph,

Thx for you're comment.

I also thought of using the cron event timer, but we can't use that due the fact that we want use the same config on all the routers.

If we use that we still have the heavy load.

I thought of something like an backup user which logs in every day.

The login for this user is already configured and it is being done in batches.

But how to set something that uses an countdown to set the trigger

We can look for pattern in log to set the event trigger:

event syslog pattern "user: backupuser" occurs 30

 

 

You can still use cron with a variable cron entry.  For example:

 

event timer cron cron-entry $cell_cron

 

Then you can specify an environment variable for each device that uses a different entry.  If that's still too much config, then your idea of triggering on a syslog based on a user login will work (provided you log on-success logins).