Arista EOS CLI Automation
Updated: Nov 16, 2018
I personally have a passion for effective network management and deterministic network behavior. I championed many network management systems (NMS), NetFlow, and sFlow solutions in a vast array of networks over the last 19 years. One of my biggest network management accomplishments was creating a successfully global managed services program that featured a cloud based network management software-as-a-service that we served. This entire program was built around a strong open-source multi-tenant NMS with our thousands of hours of custom mined SNMP OID objects that provides a myriad of information.
Enter Arista EOS management and extensibility features. It is impressive seeing the creativity, time, and development commitment that Arista’s software teams have put into their EOS manageability and extensibility features. In this blog installment I will focus on the enablement of “On-switch” EOS command output automation.
Arista EOS has a configuration command feature called “schedule”, which performs the execution of tasks and frequency that you configure. Schedule is an EOS command line scheduler similar to the Linux/UNIX “cron” utility.
We will first introduce this feature by setting up a scheduled event named “rib_db”. This scheduled event will send me an email with attaching the the “RIB” (routing table) activity output every 2 minutes.
First, I will review the schedule example followed by explaining what our “command to run” actually does. Then we will finish this example configuring schedule for our example.
1. Example Schedule #1
Schedule Name: rib_db
Start Time: now
Run Frequency: Every 2 minutes
How Many transaction log files to keep max: 20
Command to Run: show event-monitor route | email -s “Route DB Table” email@example.com
2. Explaining our example’s “command to run”:
The above example’s command to run is ‘show event-monitor route | email -s “Route DB Table” firstname.lastname@example.org‘. I will break this command down into two parts since we are using the unix pipe for command output redirection.
Command Part 1: show event-monitor route
Event-monitor is an EOS command feature that logs 5 different events to a sqlite3 database automatically. Each event has its own table in the /tmp/eventMon.db sqlite3 database. If you noticed that the directory of the event monitor database is in the “\tmp” directory then you get a star. What this means is that this database is not persistent and will not survive a reboot. If you would like EOS to preserve this database on reboots then you can configure event-monitor to mount the database into a persistent directory (not covered in this blog).
The following is a listing and brief description of the 5 events that are logged by event-monitor.
ARP – Changes to the ARP table (IP address to MAC address mappings)
IGMP snooping – Changes to the IGMP snooping table
MAC – Changes to the MAC address table (MAC address to port mappings)
mroute – Changes to the IP multicast routing table
route – Changes to the IP routing table
You can view the entries for any of the above 5 event tables by issuing the following command:
Syntax: show event-monitor [event from above]
Example: show event-monitor route
Command Part 2: email -s “Route DB Table” email@example.com
Email is an EOS feature that is exciting for network people since this is a new concept for network device manufacturers in my experience. Arista EOS is based on a Fedora linux unmodified kernel so email is just the tip of the ice berg. Knowing that the email command is part 2 of this two part command equation means that the first command part is “piping” or flowing into this command.
In other words the email command will use the ‘show event-monitor route’ part 1 command as our email’s attachment. This leaves ’email -s “Route DB Table” firstname.lastname@example.org’ which creates the email using the -s to form a subject line and using the email@example.com as the sendto.
3. Finally, Scheduling Our Example:
We are at the point where we want to configure our schedule command automation according to our #1 example above. The following complete EOS command performs the scheduling:
Please see the Arista EOS User Guide for additional detail on the schedule command.
Having the ability for your data center switches to email automated command output for routing tables, multicast route tables, ARP, MAC address, and IGMP snooping table on an interval basis is a Massive network management advantage. Using these features to add into your current network management strategy will do nothing but increase your teams insight into your Arista infrastructure.