Cisco EMM Scripts

 
Usefull EEM Scripts for running on an Cisco router
 

Simple Sample

Just a simple Test Script
	event manager applet TEST
	 event none
	 action 1.0 cli command "enable"
	 action 1.1 cli command "configure terminal"
	 action 1.2 cli command "hostname TEST"
	!
and test the running the Sample and the Output:
	evil-router#event manager run TEST
	evil-router#
	TEST#
	TEST#
	!
and if you enable debuging, you see, what is going on..
	debug event manager action cli
Some other samples:
Syslog + SNMP Trap (syslog + snmp must be configured to be running)
	event manager applet SYSLOG+TRAP
	 event none
	 action 1.0 snmp-trap strdata "TEST2-snmp-trap"
	 action 2.0 syslog msg "TEST2-syslog"
Interactive comands.
	event manager applet test
	 event none
	 action 0.9 cli command "enable"
	 action 1.0 cli command "clear counter loopback 0" pattern "confirm"
	 action 1.1 cli command "y"
SNMP Trap after Syslog Event.
	event manager applet FibDisableTrap
  	 event syslog pattern ".*FIB-3-DISABLE.*"
 	 action 1.0 snmp-trap strdata "EEM detected a FIB disable message on router1"

Simple Sample 2

Just a simple Test Script
Start a TCL-Script after reciving a UDP packet from a predefined IP and to a specivic Port:
Sample UDP Packet to Port 567 from 1.2.3.4 to the target Router (192.168.2.50)
You need to configure a ACL and a EEM Script.
 
Define ACL
 
    ip access-list extended KNOCK_567
     permit udp host 1.2.3.4 host 192.168.2.50 eq 567 log
     permit ip any any
Define Event
 
     event manager applet UDP_567
      event syslog pattern "%SEC-6-IPACCESSLOGP: list KNOCK_567 permitted udp 1.2.3.4"
      action 1.0 syslog msg "knock...knock..."
      action 1.1 cli command "enable"
      action 1.2 cli command "tclsh flash:pong10.tcl"

Cisco EMM Sample Scripts

Scheduled interfcae Up and down.
 eem_ifupdown.txt
 eem_cpuspeed.txt
 Embedded Event Manager (EEM) Scripting Community
 

(c) 2008 by packetlevel.ch / last update: 01.05.2009