cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3632
Views
0
Helpful
10
Replies

EEM / Tcl Syslog Generator

Hello Community,

Can someone please show me how compile either an EEM or Tcl Script that when run will generate a syslog event of my choosing. For example, I might want to generate the following syslog %bgp-5-adjacency. I know I can easily generate by shutting down the an interface on a router with BGP configured but I would like generate any syslog event.

Cheers

Carlton

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

You can use the special "syslog:" file system for this:

set fd [open "syslog:" "w"]

puts $fd {%BGP-5-ADJACENCY: blah blah}

close $fd

EEM will be able to intercept this message.

View solution in original post

10 Replies 10

Joe Clarke
Cisco Employee
Cisco Employee

You can use the special "syslog:" file system for this:

set fd [open "syslog:" "w"]

puts $fd {%BGP-5-ADJACENCY: blah blah}

close $fd

EEM will be able to intercept this message.

Hi Joseph,

Thanks for responding.

Excuse my ignorance, shall I cut and paste your example? If so, how do I get it to run?

Cheers mate.

This is a simple tclsh snippet.  You can run it by entering "tclsh", or you can save it in a file and do:

tclsh file.tcl

Joseph,

That is what I thought.

I enterede the command router(tcl)#tclsh syslog.tcl and nothing happened

Also when I entered the command, router#tclsh syslog.tcl and I get the following:

'couldn't read file "syslog.tcl": No such file or directory'

You may need to specify the file system:

tclsh flash:syslog.tcl

OK, going to try that now.....

Hi Joseph,

These are files in flash. I've called the one you provide syslogbgp.tcl

Directory of flash:/

    1  -rw-         151                      sysloggenIntDownv2.tcl
    2  -rw-          81                      bgplogbgp.tcl
    3  -rw-          81                      syslogbgp.tcl

When I run the following nothing happens:

tclsh flash:syslogbgp.tcl

Is there something simple that I'm missing?

Cheers

These messages are sent like debugs.  You need to make sure you are monitoring your terminal and that you're logging at the "debug" level.

Joseph,

Brilliant.

Cheers mate.

Hi Joseph,

Not sure if I need to start another discussion, however I amended you're original to the following:

set fd [open "syslog:" "w"]

puts $fd {%SPANTREE-2-BLOCK_BPDUGUARD: span span}

close $fd

The script runs without the debug level activated.

Whereas I needed to activate debug ip bgp

to get your original script to work

Is there a reason for that?

Cheers

Carlton

Review Cisco Networking for a $25 gift card