cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

ASR9000 EEM Script repository

4167
Views
0
Helpful
1
Comments
Comments
Cisco Employee

Hi

 

As we discussing at meeting ,this is my plan for EEM .

 

purpose:

Between  BFD flap (Will end in about 3 seconds), get following log 5times.

----

show interface <IF>

show controllers npu diag counters graphical instance all location all

show captured packets ingress location <LC>

show captured packets egress location <LC>

show controllers npu stats traps-all instance all location all

show spp node-counters location all

----

 

Config :

aaa authorization commands eem-method none

aaa authorization eventmanager default local

!

line template eem-template

authorization commands eem-method

!

event manager directory user policy disk0:

event manager policy <script name> username cisco persist-time 3600

 

script:

::cisco::eem::event_register_syslog occurs 1 pattern ".*bfd_agent.*BFD session to neighbor.*has gone down" maxrun_sec 30

#------------------------------------------------------------------
# EEM policy to monitor BFD
#
#
# Cisco Systems
#
#
# Copyright (c) 2010 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------

###

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

# 1. query the information of latest triggered eem event
array set arr_einfo [event_reqinfo]

if {$_cerrno != 0} {
set result [format "component=%s; subsys err=%s; posix err=%s\ns" \
$_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]
error $result
}

set msg $arr_einfo(msg)

# 2. Execute the debug
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}

# 2. <IF> need to be specified
if [catch {cli_exec $cli1(fd) "show interface <IF> | file harddisk:show interface <IF>"} result] {
error $result $errorInfo
}

# Execute the CMD
if [catch {cli_exec $cli1(fd) "show controllers npu diag counters graphical instance all location all | file harddisk:show controllers npu"} result] {
error $result $errorInfo
}

# <LC> need to be specified
if [catch {cli_exec $cli1(fd) "show captured packets ingress location <LC> | file harddisk:show captured packets ingress"} result] {
error $result $errorInfo
}

# <LC> need to be specified
if [catch {cli_exec $cli1(fd) "show captured packets egress location <LC> | file harddisk:show captured packets egress"} result] {
error $result $errorInfo
}

# Execute the CMD
if [catch {cli_exec $cli1(fd) "show controllers npu stats traps-all instance all location all | file harddisk:show controllers npu"} result] {
error $result $errorInfo
}

# Execute the CMD
if [catch {cli_exec $cli1(fd) "show spp node-counters location all | file harddisk:show spp"} result] {
error $result $errorInfo
}
# Execute the CMD
if [catch {cli_exec $cli1(fd) "show bfd session detail | file harddisk:show-bfd"} result] {
error $result $errorInfo
}

#Notify via a syslog message that we had this event.

action_syslog priority info msg "capture BFD info via EEM TCL!"

 

 

could you confirm.

 

Regards,

Kun Liu

Content for Community-Ad