Thursday, August 28, 2008

Linux automation with Expect

I've been using an expect script that I wrote for a number of years now to deal with some password changes. Expect is like a macro program that you code yourself. You can use it to deal with some GUI automation, I've only used it to deal with automating interactive programs that require input.

One of the toughest things for me to figure out was how to deal with command line variables. Once that was solved, I was able to create a pretty generic script with it.

Using Expect to automate tasks (password change)

Wednesday, August 27, 2008

Bottlerocket

I finally got around to hooking up the x10 thing to the T.V. It took some messing around but I finally got it working. The trick was to use the correct serial port. I still can't figure out how to set the default port.

My boss gave me his "firecracker" x10 device. I hooked it up to my Debian box. In order to use it, you need to install the bottlerocket package.

apt-get install bottlerocket

There was one time that dpkg asked me what port to use and I guessed at ttyS0 and that was wrong. If you can figure out the correct serial port before hand, that seems to be best. Since I guessed wrong I have to issue the bottlerocket command:

br --port=/dev/ttyS1 a1 off

And that turns off the T.V. Now I can be at work and via SSH turn off the T.V. and make the kids read a book. Now if I can just get the rest of the lights hooked in. MUAHAHAHAHA!

Monday, August 25, 2008

Monadnock 08


Monadnock 08
Originally uploaded by Qfamily.
The annual Monadnock climb was successful. I think I need to work up to a bigger climb soon.

Friday, August 22, 2008

Cisco Backups (SNMP and TFTP)

Here is some info for backing up Cisco gear using SNMP and TFTP. I'm currently just using a cron job that sends an SNMP SET command to the Cisco device which triggers a TFTP transfer of the config. You can use different OID's to get the running config or the config from NVRAM.

This is the important part (Perl code):
`snmpset -c $rwpassword -v2c $ipaddy .1.3.6.1.4.1.9.2.1.55.$tftp_server string $name.bak`;


I have an updated script that deals with getting the running config vs. the stored config and also gets the config from CatOS devices. If anyone is interested in it, either comment or send me an email (jason[at]cosmicegg.net) and I'll post it.

Here is a Google Doc with some more information:
Cisco Routers and Switches Backups