Getting your router to Tweet

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:

        gives you

Then copy the downloaded tweet-policy.tcl to your routers Flash:, either by TFTP or manually create it. I’ll show how to create the file manually in Flash:

Cisco-877#mkdir flash:eem
Create directory filename [eem]?
Created dir flash:eem

Cisco-877(tcl)#puts [open "flash:/eem/tweet-policy.tcl" w+] {
+>             #COPY AND PASTE THE CONTENTS OF 'tweet-policy.tcl'

+> }            <------DONT FORGET THE '}' AFTER THE PASTE


Cisco-877#dir flash:eem
Directory of flash:/eem/

 4  -rwx        4812  Jan 20 2010 15:04:43 +00:00  tweet-policy.tcl

23482368 bytes total (2254848 bytes free)

Then configure the event manager policy settings:

event manager environment _tweet_b64 dHdpdHRlci11c2VybmFtZTp0d2VldC1wYXNzd29yZA==
event manager environment _tweet_ip
event manager directory user policy "flash:/eem"
event manager policy tweet-policy.tcl type user

The last thing left is to execute the EEM policy. This could be done manually or by specifying an EEM detector. Here is the manual way:

event manager run tweet-policy.tcl

All credit is due to Bruno Klauser for assisting and writing this neat script. Obviously be careful what you tweet to a public system. I won’t recommend tweeting your production networks syslog, unless you limiting the viewing access to your twitter account. I have another idea or two, that I will use this for. But more on that later.

Visit to see Bruno’s tweeting syslog.

PS, just a tip. Once you loaded the policy, if you change something in the policy file, you need to de-register and re-register the policy. Just changing the file is not sufficient, because IOS parses the policy and loads it into a protected memory space upon registration. The command below is an exec command which combines de-registration, tftp download and re-registration.

event manager update

Please leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.