Archive for the ‘TCL’ Category

h1

Getting your router to Tweet

January 20, 2010

Ok, so an earlier post sharing a really neat geek trick is awesome, but how the hell does one go about configuring a router to tweet something? (if you not a programmer)

To do it, you would need the following:

  • IOS image that supports EEM.
  • A twitter account.
  • A base64 encoded representation of you twitter account’s
  • Bruno’s twitter script. Download tweet-policy.tcl here.
  • The IP address of your nearest twitter server. (nslookup or dig will help you there)

The IOS obviously must support EEM.

Then once you have your twitter account, you need to encode your twitter account’s username:password to a base64 encoded representation.  Could be done using this website. Example:

twitter-username:tweet-password
        gives you
dHdpdHRlci11c2VybmFtZTp0d2VldC1wYXNzd29yZA==

Read the rest of this entry ?

About these ads
h1

Using TCL/EEM to tweet SYSLOG events

January 17, 2010

Staying in the focus of the previous article, this is one of those really cool features, but possible something that you won’t easily use in production. Or maybe you would!

How about taking your routers syslog events and sending them to a twitter account. That way you can easily keep on heights when something in your network goes really wonky.Why would you want to do this?  To have a publicly accessable syslog replacement, or just because you can!

Bruno Klauser from Cisco wrote a TCL script using EEM to tweet routers syslog messages to a twitter account.  Here is an example of one tweeting router:  EASyDMI.

If you want to use this or give it a try, download the script at Cisco Land, and see my post on how to configure this.

h1

Tcl-Script Variations

March 28, 2009

Ok, so we all know that a TCL can be cool.  But are you using the easiest why to do the all well-known ping-script.
Let me show you 3 ways to do the same thing, and then the really cool lazy way.

First method is kinda cool, since you creating an executable file in flash that is there, to be used whenever.
(the w+ means to write/overwrite, or if you want to append the file use a+ instead)
#tclsh
puts [open "flash:ping-script.tcl" w+] {
foreach IP {
150.1.1.1
204.12.1.254
} { puts [ exec "ping $IP re 2" ] }
}
(tcl)#tclquit

Then to execute the file from global configuration mode:
#tclsh ping-script.tcl

Read the rest of this entry ?

h1

Auto Reloading your router with TCL

March 13, 2009

So you would like to Auto reload all the 6 of 10 routers in your rack and maybe you would like to clear the config at the same time?

A ‘Send *’ from your Access-Server would apply to all connected routers and switches . Not cool, since you do not want to reload the backbone routers and the frame-switch’s config every time. And quite frankly erasing and reloading one router at a time is just to much work and wastes time. Studying for you CCIE? Then you will know you don’t have time to waste.

So how to go about this? You could create 2 EEM applets in every initial config before loading the routers as follow:

event manager applet writeerase
event none
action 1.0 cli command "write erase"
!
event manager applet forcereload
event none
action 1.0 reload

Then from your access-server, you could run the following, causing only the routers that have the applets loaded interpret the send commands:

Send *
Enter message, end with CTRL/Z; abort with CTRL/C:
event manager run writeerase
event manager run forcereload
Send message? [confirm]

But really, this is still TOO MUCH work. Updating each initial config of every lab. There is always a “lazier” way to do stuff.
What we need is a file saved on the router that is not affected when the config is erased. Hmmm…. a small TCL-script could do that.

Read the rest of this entry ?

h1

TCL’in Orphaned Telnet Sessions

November 27, 2008

In a previous post, I showed how to deal with hung/orphaned telnet sessions. And although that works, I find it just to annoying to enter the same command 10 times over, apart from wasting time.

So instead I wrote a really simple Tcl script yesterday, to accomplish the same. I say simple, because yesterday I didn’t really take the time to optimize the amount of lines in the scripts, which could easily be shortened to about 10 lines. Make no mistake, I’m not a code-monkey.

The Cisco IOS Scripting with Tcl feature provides the ability to run Tool Command Language (Tcl) version 8.3.4 commands from the Cisco IOS command-line interface (CLI). TCL is pronounced ‘tickle’. More info in Cisco Land.

So just to recap, same predicament as before where telnet session are hung/orphaned. Example:

shline.

We can create the TCL script manually every time, using TCLSH, but we not getting around the “being lazy” part. So a better way is to create the TCL script in flash, and execute the file from there when needed.

Read the rest of this entry ?

Follow

Get every new post delivered to your Inbox.

Join 1,512 other followers