natjohan's blog

Posted mar. 14 janvier 2014

Tip of the week 29

A little Cisco IOS Embedded Event Manager (EEM) script example

Here is a little script to retrieve and store the output of command periodically on your cisco router. It can be usefull when logs don't want to speak.

conf t
event manager session cli username <myusername>
event manager applet MyScriptLogs
event timer watchdog name MyScriptLogs time <mytimer>
action 1 cli command “en"
action 2 cli command “show clock | append bootflash:MyScriptLogs"
action 3 cli command "show policy-map interface | append bootflash:MyScriptLogs"

Where <myusername> is an user who has privileges to execute the following commands and <mytimer> is the time in seconds between each instance of the script.

Note : you can add many commands to this script with 'action X cli command'.

Go Further

EEM on Cisco website

Category: ToTW
Tags: cisco script eem