Love Google Calendar!

I always use the quick add feature of Google Calendar to add events, that way I can type in things like "Call with Jack Tuesday morning at 9" and an event is added. Today I figured I'd paste this directly from an email:

Blake has a meeting in Houston on Tuesday. We need to change the staff
meeting to Wednesday. I was thinking 10:00 if that works for you.

It seemed like a long shot, but it worked! It made an event on Wednesday at 10 am, I was surprised and then realized that in the future these sorts of things will be parsed from your email automatically and you'll simply accept them into your calendar. I like!


Nagios Asterisk IAX2 POKE with check_asterisk.pl

It seems that since around Asterisk the Nagios contrib plugin check_asterisk has stopped working for the "iax ping" feature. I turned on iax debugging in Asterisk and did a packet capture. Seems like the only reason why it worked was because it sent a 0x06 REJECT frame and Asterisk would reply with invalid. I changed it to send a 0x1e POKE request and submitted a small patch to fix this in the plugin. I seriously doubt the Nagios Plugins team will do anything with it since there's no upstream maintainer and it's in the contrib directory so here's the patch:

--- check_asterisk.pl 2009-09-24 03:13:56.000000000 -0700
+++ check_asterisk.pl.changed 2009-11-01 13:10:06.000000000 -0800
@@ -31,7 +31,8 @@
my $iax_timestamp = "00000000";
my $iax_outbound_seq = "00";
my $iax_inbound_seq = "00";
-my $iax_type = "06"; #IAX_Control
+my $iax_type = "06"; #IAX_Control
+my $iax_frame_value = "1e"; #POKE

sub ok {
$s = shift;
@@ -224,7 +225,7 @@
socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp"));

$msg = pack "H24", $iax_src_call . $iax_dst_call . $iax_timestamp .
- $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_type;
+ $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_frame_value ;

$ipaddr = inet_aton($host);
$sendto = sockaddr_in($port,$ipaddr);

You should also check out this patch that adds performance data to the Nagios plugin. Good for graphing channel usage over time.

* IAX2 RFC Document
* Nagios Plugins
* Bug/Patch Report


Linux Software RAID Nagios Monitoring & Failure Simulation

It's always nice to monitor to make sure your technology is working properly, it's nicer knowing that when it fails it will alert you to what happened so sometimes you need to test the scenarios. This is just an overview using Debian Lenny of how to use the Linux mdadm tool to create, destroy and rebuild a software RAID 1 (mirror) device. Throughout the process you will see the effects of the Nagios check_linux_raid plugin from the Nagios Plugins project.

First I installed the Nagios plugins and mdadm:
>apt-get install mdadm nagios-plugins

I used fdisk to create two partitions: /dev/sdc1 & /dev/sdc2 (of equal size, in this case 40 MB, I know, I'm generous.)

I then used the following command to create a RAID 1 array with the two disks. I happened to call it md0:
>mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdc2

Created an ext3 filesystem on my array:
>mkfs.ext3 /dev/md0

Mounted the new file system in an arbitrary location:
>mount /dev/md0 /media/raid

The array is now active and happy, here's how to verify:
>mdadm --detail /dev/md0
Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 8 34 1 active sync /dev/sdc2

Now I will run the first test of the Nagios plugin, you can give it the device name if you like or it can detect your devices for you. As you can see all OK (exit status 0):
OK md0 status=[UU].

Now I'm going to set one of my block devices as faulty:
>mdadm /dev/md0 -f /dev/sdc2
mdadm: set /dev/sdc2 faulty in /dev/md0

To verify the array is degraded we'll look at the details again:
>mdadm --detail /dev/md0
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0

UUID : 3103faf6:34bec8ae:2689ae2c:f32f1e02 (local to host buenos-aires)
Events : 0.8

Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 0 0 1 removed

2 8 34 - faulty spare /dev/sdc2

You'll notice /dev/sdc2 is now marked as a faulty spare.

Another check of the Nagios Plugin reveals an exit code of 2 and the service as critical:
CRITICAL md0 status=[U_].

I now remove the faulty device from the array completely (note it must be marked faulty first per the last step):
>mdadm /dev/md0 -r /dev/sdc2
mdadm: hot removed /dev/sdc2

Again test the plugin, still marked as down:
CRITICAL md0 status=[U_].

Now I can re-add the device to the array (since there's really nothing wrong with it). Once it rebuilds you can test again and it will show as OK on the Nagios plugin.
mdadm /dev/md0 -a /dev/sdc2

You can read more about Linux software RAID here. Or about Nagios here.


Moving, Migrating, or Backing Up Microsoft PPTP VPN Profiles

So I'm moving from one Windows XP machine to another and I don't want to have to set up all the VPN profiles again. They are stored in the file

C:\Documents and Settings\All
Users\Application Data\Microsoft\Network\Connections\Pbk\RASPhone.pbk

Just make a copy of that file and put it on your new system. It doesn't save your passwords though. I'll update this post if I find a way to back up the saved passwords.


Comparison of Windows Mobile 6.1 and 6.5

Complaints about Windows Mobile 6.1
I've owned an HTC Fuze (aka Touch Pro or P4600) Windows Mobile phone since mid February of 2009. General impressions of the hardware are good, a solid construction paired with a beautiful VGA resolution screen. My first PC came with a 15 inch 640x480 monitor, this has a 2.8 inch 480x640, 3:4 aspect ration screen. 5X smaller, with 16 bit color. This is the most attractive thing about this device. Dead sexy.

So far I've been rather unimpressed by the lack of stability on the phone. There are many quirks to it. One especially annoying one is when you start to run low on batteries the phones' phony notification system turns on, along with the back light and radios to alert you that the battery is dying. If you didn't notice, it's kind enough to stay on until it goes completely dead. This is a major issue with the phone, it already has pretty lousy battery life (though not too far from what the iPhone gets).

Another major annoyance is that the keyboard stops working when you are typing sometimes. I assume there's a background process that eats all the CPU cycles. There's little consistency to the problem in that sometimes input will be queued and released all at one or not at all. Pain in the butt to type on when this happens, the keyboard on the Fuze is one of the best I've seen - seems like the software is to blame here.

The phone needs a lot of rebooting, especially using programs other than email. It is so bad that I read on a forum somewhere "Do this procedure every reboot or once a day" - Like rebooting once a day is totally normal - that's the Windows Me mentality that has held a dark shitty cloud over Microsoft for some time.

Windows Mobile 6.5
Windows Mobile 6.5 is set to be seen on the first consumer device by September 2009, most phone manufacturers received the software in May. I'm using a beta preview.

One of the problems with 6.1 is that I have to run a separate package on top of Windows called Touch Flo 3D. This makes the phone a bit more touch friendly but adds a giant layer of clunk. Below TF3D is 6.1 so you only get the nicer experience some of the time. With 6.5 one of the major changes is a redesign of the Today screen. It gives you quicker finger-friendly access to email, text, music, photos, videos, and bookmarks. Though TF3D also does this it's a memory hungry app that resides on top of the OS, this is better integrated and lighter.

The second major area of improvement is the Start Menu. The start menu uses hexagonal shapes for icon placement. The icons are a beautiful resolution and quite easy to navigate with the fingers, stylus, . Scrolling is pretty nice and you can re-arrange the icons by sending them to the top.

Windows Mobile was designed a LONG time ago and I don't think anyone thought that it would be ran on a mobile phone with a touch screen. It is really designed for a stylus - not a finger. I find myself when doing heavy computing on the device with the keyboard slid out, the stylus in my hand and my thumbs on the screen. Beleive it or not - this is actually a really awesome way to use the phone - I can be doing quite a bit at once. To conclude this statement - 6.5 adds some finger friendly features however it does not stop you from having to use the corner of a finger nail to press the dreaded OK button. I often open up the keyboard and press the OK button there instead of messing with it.

Overall - I'm pretty happy with the stability that 6.5 offers. There's a Marketplace feature (similar to iPhone's App Store) that is coming with the release. That should be interesting.


Naming of ethernet devices on Debian

If you change network cards in Debian, the new card will get a new "ethX" name, assuming that perhaps you want to put the old one back one day and keep the configuration.

Sometimes this isn't the case and you don't want to have ethernet devices named eth5 or similar.

A simple fix, the file:


has the rules to persistently name your ethernet interfaces, simply edit that and remove any entries that are no longer needed; renaming the other ones to your needs. The file had the driver and MAC address so they are simple to find. Here's an example (with the macs slightly changed):

# PCI device 0x8086:0x1076 (e1000)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:14:22:72:d7:2d", NAME="eth0"

# PCI device 0x8086:0x1076 (e1000)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:14:22:72:d7:2c", NAME="eth1"

# USB device 0b95:7720 (asix)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:50:5b:04:85:5f", NAME="eth2"


Pasting in Vim

For years now I've been using nano with the no word wrap flag to paste stuff into *nix terminals. This kind of sucks because Vim is my favorite editor, however when you try to paste it indents everything for you and ends up with a bloody mess. Well I found that you can:

:set paste

paste what you want and then

:set nopaste when you're done. Wooohoo!


Update on my eeePC

So a few weeks ago I was working on my eeePC and got some kernel panic warnings and disk read errors. I rebooted to run a full fsck..Sure enough my drive was completely corrupt. I reformatted after playing around with badblocks. Still no joy after that, the drive had a physical problem with it.

I started the somewhat tedious process of sending the netbook in for warranty repairs. I must say that Asus obfuscates the whole process, most likely in hopes that people will simply give up and buy a new laptop. The phone menus were terrible, only after emailing them they told me the right key sequence to push to successfully navigate to the warranty section. The key sequence would have been impossible to get to since it was not advertised by their phone menu. As a guy that occasionally programs auto attendant menus - that's terrible. Fsck that.

The process took about 2 weeks but I got back Friday.

I decided to give openbox + lxde a try, running on the newly released Debian Lenny. So far so good. I ran into an issue with getting wireless going on Lenny final, I had to compile the madwifi source since the open source driver, ath5k did not do what it advertised. I'm not a huge GNU purist so I don't really care.

I'm disappointed to have hardware problems so early in this machine's life..might be just a fluke though.