Cisco NX-OS Scheduler
The scheduler is another feature in Cisco NX-OS that adds to the automation technologies in the data center. The scheduler can be used to run tasks automatically, without any intervention from the administrator, who can set them for periodic execution or to run at a specific time. This is extremely convenient when it comes to automating tasks such as creating backups, saving configurations, pushing a notification, and so on.
There are two main components to the scheduler (see Figure 20-3):
Figure 20-3 Cisco NX-OS Scheduler
- Job: This is the task that needs to be performed. There can be multiple jobs.
- Schedule: When and how many times a job is to be executed:
- Periodic mode: This defines a recurring execution, at daily, weekly, monthly, or delta intervals.
- One-time mode: This specifies a one-time execution.
When you’re working with the scheduler, it is important to keep in mind that if a feature you intend to use as a job requires a specific license, you have to check whether the license is present on the switch. Otherwise, if the scheduler attempts to execute the job and the license is not present, the job will fail. The other limitation is that if the command to be executed is interactive, the job will fail again.
For job creation, you use the standard command from the CLI. You also have the flexibility to use variables. Some of the variables are predefined in the system, such as TIMESTAMP, but you can also define a variable with the command cli var name.
The scheduler is a feature for automating tasks on a per-device basis. It needs to be configured and executed on each device.
Cisco EEM
The Cisco Embedded Event Manager (EEM) is one extremely flexible tool for automating the behavior of a Cisco NX-OS device. It allows you to configure events that will trigger one or more actions.
A Cisco EEM policy consists of three components:
- Event: What will trigger the policy? Various events can start the execution of the EEM policy, including the following:
- Memory: Triggers an event if memory thresholds are crossed.
- Counter: Triggers an event if counter thresholds are crossed.
- Module: An event is triggered if the selected module enters a specific state.
- None: No event; describes a manual run of the EEM policy.
- CLI: When a specific command is executed in the CLI, the policy is triggered.
- Action: What will happen when the event that triggers the policy occurs. This can be one or more actions, including the following:
- Execute a command in the CLI.
- Generate a notification using SNMP or Call Home.
- Generate a syslog entry.
- Shut down a module or an interface.
- Reload the device.
- Use the default action for the system policy.
- Applet: This is the configuration construct of the EEM that links events with actions.
The applet is used to create an EEM policy in the CLI. There is also the option to create a policy with a script in virtual shell and then copy it to the device and activate it.