Genie's Tech Blog

Where knowledge has no dimensions

Configuring Scheduler in Nexus

Hello Friends,

Today, we will be discussing about how to configure Scheduler on Nexus platform. Before we jump to configuration, lets understand the purpose of scheduler. The purpose of the scheduler is to assist the network admins with performing maintenance activities like saving configuration or performing a backup or it can also be used for performing stress testing in labs by simulation scenario's like interface flaps, linecard reloads, Supervisor switchover, etc. To perform certain tasks, Scheduler makes use of an Event Manager Applet also called the EEM Scripts. Under the Event Manager Applet, we define the steps / actions to be performed. Then We create a scheduler job which binds the Event Manager applet to the job. And finally we create a scheduler schedule calling the job and specifying the timers on when and how to run the same.

On Nexus, In order to configure the scheduler, we need to enable the feature. 

CGT-N7K-2(config)#feature scheduler

You can verify if the feature is enabled or not using the show command "show feature | in enabled".

Lets understand the working of the Scheduler with the help of an example. In this example, we shall create two jobs. In the first one, we will try to perform a shut / no shut to the interface and on the other one we will try to perform a Supervisor card switchover (Running in SSO mode).

event manager applet link_flap
  action 0.1 cli enable
  action 1.1 cli conf t
  action 1.2 cli inter e4/42
  action 1.3 cli shut
  action 1.4 cli sho clo
  action 1.5 cli show clo
  action 1.6 cli no shut
!
event manager applet sso
  action 0.1 cli enable
  action 1.1 cli system switchover
!

In the above configuration, we have first create two EEM Scripts. In the first one, we are trying to perform a shut / no shut on the interface e4/42. In the second one, we are performing system switchover. We shall now create scheduler jobs to bind these scripts.

scheduler job name link_flap_sched
event manager run link_flap

end-job
!
scheduler job name sso_sched
event manager run sso
 
end-job
!
Using the configuration command scheduler job name <name>, we create the scheduler job. Once we have created the scheduler job, we then bind the Event Manager to run the scripts created above.

We will now create the scheduler schedule to run these jobs at particular time intervals.

scheduler schedule name link_flap_sched
  job name link_flap_sched
  time start now repeat 0:0:2
!
scheduler schedule name sso_sched
  job name sso_sched
  time start now repeat 0:0:15
!

In the above configs, we have created the two schedules which start immediately. The first schedule repeats itself every 2 min. where as the later one repeats itself every 15 min. In the time start command, the cli gives two options:

CGT-N7K-2(config-schedule)# time start ?
  WORD  Start-time {[[[[yyyy:]mmm:]dd:]HH]:MM | +[[dd:]HH:]MM} (Max Size 18)
  now   Start-time = 2 minutes from `now'

If we want to manually specify the time, we can configure the statement as "time start 2015:02:09:06:20 repeat 0:0:15". The repeat statement is in the form of "Days:Hours:Minutes".

Once we have configured the scheduler schedule, the job starts executing. We can check the status of the scheduler using the "show scheduler schedule" output

CGT-N7K-2# show scheduler schedule
Schedule Name       : link_flap_sched
-------------------------------------
User Name           : admin
Schedule Type       : Run every 0 Days 0 Hrs 2 Mins
Start Time          : Mon Feb  9 06:20:00 2015
Last Execution Time : Mon Feb  9 14:18:26 2015
Last Completion Time: Mon Feb  9 14:18:27 2015
Execution count     : 241
-----------------------------------------------
     Job Name            Last Execution Status
-----------------------------------------------
link_flap_sched                   Success (0)
==============================================================================
Schedule Name       : sso_sched
-------------------------------
User Name           : admin
Schedule Type       : Run every 0 Days 0 Hrs 15 Mins
Start Time          : Mon Feb  9 06:20:00 2015
Last Execution Time : Mon Feb  9 14:00:21 2015
Last Completion Time: Mon Feb  9 14:00:22 2015
Execution count     : 24
-----------------------------------------------
     Job Name            Last Execution Status
-----------------------------------------------
sso_sched                         Success (0)
==============================================================================
You can also see the jobs attached to the scheduler using the command "show scheduler job".
CGT-N7K-2# sh scheduler job 
Job Name: link_flap_sched
-------------------------
event manager run link_flap
 
==============================================================================
Job Name: sso_sched
-------------------
event manager run sso
 
==============================================================================
Hope this post helps understand how we can leverage the Nexus Scheduler and EEM to perform some maintenance activities or for testing purposes.
Please feel free to reach out to me in case of any queries.

Cheers...!!!

Comments are closed