01-03-2013 10:33 AM
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
Solved! Go to Solution.
01-03-2013 10:36 AM
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.
01-03-2013 10:36 AM
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.
01-03-2013 11:02 AM
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.
01-03-2013 11:09 AM
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
01-03-2013 11:15 AM
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'
01-03-2013 11:16 AM
You may need to specify the file system:
tclsh flash:syslog.tcl
01-03-2013 11:26 AM
OK, going to try that now.....
01-03-2013 11:36 AM
Hi Joseph,
These are files in flash. I've called the one you provide syslogbgp.tcl
Directory of flash:/
1 -rw- 151
2 -rw- 81
3 -rw- 81
When I run the following nothing happens:
tclsh flash:syslogbgp.tcl
Is there something simple that I'm missing?
Cheers
01-03-2013 11:44 AM
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.
01-03-2013 12:22 PM
Joseph,
Brilliant.
Cheers mate.
01-04-2013 05:45 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide