cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3158
Views
5
Helpful
1
Comments
Nadeem Ahmed
Cisco Employee
Cisco Employee

Objective: The objective of this document where some customer/users wants to  automatically or Schedule shutdown Dial-peers without any manual intervention. This came to my where we had interaction with one customer whose requirement was to shutdown International and National Dial-peers on weekends. There could be many scenario like system being hacked or misuse of international dialing over a weekend etc..

Solutions: We can do that by using Embedded Event Manager (runs on Cisco IOS router) which would have the event trigger by cron.

Example: Here we are schedule shutdown of dial-peer 11 and 110 pots at 4:00 AM every Sunday.

event manager applet DIALPEERSHUT

event timer cron name DIALPEERSHUT cron-entry "00 4 * * 0"

action 1.0 cli command "enable"

action 1.1 cli command "configure terminal"

action 1.2 cli command "dial-peer voice 11 pots"

action 1.3 cli command "shutdown"

action 1.4 cli command "dial-peer voice 110 pots"

action 1.5 cli command "shutdown"

action 1.6 cli command "exit"

To schedule no shutdown the dial-peer then you have to create another EEM

Example: Here we are schedule no shutdown of dial-peer 11 and 110 pots at 5:00 AM every Sunday.

event manager applet NODIALPEERSHUT

event timer cron name NODIALPEERSHUT cron-entry "00 5 * * 0"

action 1.0 cli command "enable"

action 1.1 cli command "configure terminal"

action 1.2 cli command "dial-peer voice 11 pots"

action 1.3 cli command "no shutdown"

action 1.4 cli command "dial-peer voice 110 pots"

action 1.5 cli command "no shutdown"

action 1.6 cli command "exit"

You can manipulate the cron-entry according to your need but you have understand cron-jobs and cron-timer. There are normally  seven fields in one entry. The fields are: Minute, Hour, dom (Day of month), month, dow(day of week), user, cmd.

minute	This controls what minute of the hour the command will run on,
	 and is between '0' and '59'
hour	This controls what hour the command will run on, and is specified in
         the 24 hour clock, values must be between 0 and 23 (0 is midnight)
dom	This is the Day of Month, that you want the command run on, e.g. to
	 run a command on the 19th of each month, the dom would be 19.
month	This is the month a specified command will run on, it may be specified
	 numerically (0-12), or as the name of the month (e.g. May)
dow	This is the Day of Week that you want a command to be run on, it can
	 also be numeric (0-7) or as the name of the day (e.g. sun).
user	This is the user who runs the command.
cmd	This is the command that you want run. This field may contain 
	 multiple words or spaces.

If  you don't wish to specify a value for a field in the cron-entry , just place a * in the field

Example:

01 * * * * root echo "This command is run at one min past every hour"
17 8 * * * root echo "This command is run daily at 8:17 am"
17 20 * * * root echo "This command is run daily at 8:17 pm"
00 4 * * 0 root echo "This command is run at 4 am every Sunday"
* 4 * * Sun root echo "So is this"
42 4 1 * * root echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * root echo "This command is run hourly on the 19th of July"

Notes:

Under dow 0 and 7 are both Sunday

Conculsion: You are not just bounded to dial-peer you can paly around with many things and create your EEM accordingly, like show command output any particular time frame or you need output for interval of an hour or 30 mins or so and dump to flash , shutting interface, action reload etc..

http://www.cisco.com/c/en/us/td/docs/ios/12_2s/feature/guide/fs_eem2.html

Br,

Nadeem Ahmed

Happy Learning!!

Comments
ibrahim Adhami
Level 1
Level 1

I like the idea really nice thinking and helpful, Thanks!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: