cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1860
Views
0
Helpful
4
Replies

Error with Service Diagnostics - BGP EEM

john-farag
Level 1
Level 1

Hello,

I am trying to implement the BGP Service Diagnostics TCL scripts found at: https://supportforums.cisco.com/docs/DOC-19393

Specfically, I want to receive syslog and/or email notifications when a BGP neighbor goes down.

I am following the guide located at:
http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6555/ps9424/white_paper_cisco_ios_service_design_bgp_osp_qos.html

I am performing the manual implementation (no EMM), and get to the point of setting the variables like so:

tclsh flash:/svc-diag/sdiag_bgp.tcl bgp_neighbor_loss.tcl syslog FALSE FALSE flash:/svc-diag flash:/user_library

When I test the script by pulling the interface, and therefore losing the BGP adjacency, I get the following syslog messages:

*Jun 18 13:02:01.846: %BGP-5-ADJCHANGE: neighbor X.X.X.X Down Interface flap

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: invalid command name "exec_show_commands"

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     while executing

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: "exec_show_commands "show ip bgp neighbor $ip_address | i Last reset""

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     invoked from within

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: "$slave eval $Contents"

*Jun 18 13:02:02.182: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     (procedure "eval_script" line 7)

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     invoked from within

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: "eval_script slave $scriptname"

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     invoked from within

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: "if {$security_l

BGP-LAB-INTERNevel == 1} {       #untrusted script

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:      interp create -safe slave

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:      interp share {} stdin slave

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:      interp share {} stdout slave

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: ..."

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl:     (file "system:/lib/tcl/base.tcl" line 50)

*Jun 18 13:02:02.186: %HA_EM-6-LOG: bgp_neighbor_loss.tcl: Tcl policy execute failed: invalid command name "exec_show_commands"ET_GW(config-if)#

Here is the output of of show flash:

BGP-LAB-INTERNET_GW#sh flash:
-#- --length-- -----date/time------ path
1            0 Jun 13 2013 18:46:58 +00:00 user_library
2          131 Jun 13 2013 18:52:06 +00:00 user_library/email_template
3        16441 Jun 13 2013 18:52:14 +00:00 user_library/userlib.tcl
4         8533 Jun 13 2013 18:52:32 +00:00 user_library/diag_lib.tcl
5         4280 Jun 13 2013 18:52:40 +00:00 user_library/sdiag_lib.tcl
6         1713 Jun 13 2013 18:52:50 +00:00 user_library/bgp_lib.tcl
7         2959 Jun 13 2013 18:52:56 +00:00 user_library/tclIndex
8        13484 Jun 13 2013 18:53:06 +00:00 user_library/lib.tcl
9          131 Jun 13 2013 18:51:46 +00:00 copy
10    36720544 Jun 3 2013 16:09:14 +00:00 c3825-advipservicesk9-mz.124-13.bin
11           0 Jun 13 2013 15:48:48 +00:00 svc-diag
12       16331 Jun 13 2013 18:41:58 +00:00 svc-diag/sdiag_bgp.tcl
13       10110 Jun 13 2013 18:42:44 +00:00 svc-diag/bgp_neighbor_loss.tcl
14       22425 Jun 13 2013 18:42:54 +00:00 svc-diag/bgp_neighbor_formation.tcl
15       20987 Jun 13 2013 18:43:06 +00:00 svc-diag/bgp_neighbor_route.tcl
16        5900 Jun 13 2013 18:43:42 +00:00 svc-diag/sdiag_bgp_display.tcl
17       10741 Jun 13 2013 18:44:40 +00:00 svc-diag/sdiag_bgp_undeploy.tcl
18        6085 Jun 13 2013 18:44:58 +00:00 svc-diag/collectEmailParameters.tcl

27103232 bytes available (36909056 bytes used)

Any assistance would be appreciated.

Thanks!

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

In config mode, try:

no event manager directory user library flash:/user_library

event manager directory user library flash:/user_library

Then see if the policy will work.

Joseph,

The above commands didn't seem to do the trick. Still receiving the "invalid command name "exec_show_commands"" error.

Thanks.

Copy this code into bgp_neighbor_loss.tcl.  I think they forgot to either include the library or add the function:

source "sdiag_lib.tcl"

If that doesn't work, add this code to bgp_neighbor_loss.tcl:

proc exec_show_commands {command} {

    global errorInfo

    if [catch {cli_open} result] {

        error $result $errorInfo

    } else {

        array set cli1 $result

    }

    if [catch {cli_exec $cli1(fd) "enable"} result] {

        error $result $errorInfo

    }

    if [catch {cli_exec $cli1(fd) $command} result] {

        error $result $errorInfo

    } else {

        set show_command_output $result

    }

    if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {

        error $result $errorInfo

    }

    return $show_command_output

}

Jerome Tissieres
Spotlight
Spotlight

Sorry but to receive a syslog when a BGP session goes down you do not need EEM. Normal logging is enough:

!

router bgp 1234

bgp log-neighbor-changes

!

logging host x.x.x.x

Best Rgds,

Jerome

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: