Friday, June 20, 2008

I haven't dug around in the commit logs enough to figure out when support was added (looks like it has been there a while), but with Rails 2.1 the documentation caught up and ActiveRecord::Serialization#to_xml supports nested includes. Note that the syntax of the hash that :include is expecting is different from the syntax of the :include hash for find, for whatever reason, so check the docs.

Here's the commit that added the documentation:

Until is updated with the 2.1 API docs you can view them here:

Monday, June 16, 2008

I tried to install RHEL 5 x86_64 in a VMware Server 2.0 Beta 2 virtual machine. The host system has a 64 bit CPU and the virtual machine had been configured for a 64 bit OS. Nevertheless the installer failed with:

Your CPU does not support long mode. Use a 32 bit distribution

Some poking around turned up this VMware document. In short I had to go into the BIOS on my host system and enable Virtualization Technology. On my Dell server that was disabled by default.
I moved my Cacti install from one host to another. After dealing with some other issues the poller seemed to be running more-or-less alright. But the rrd files in the rra directory weren't updating and the graphs weren't displaying. There weren't any obvious errors in cacti.log. Looking around on the web folks mostly pointed to issues with file permissions on the rrd files or the rra directory. Sure enough, I had that problem (in the process of moving I upgraded to a new version of Cacti and switched to Dag's RPM package, which uses a 'cacti' user with a different UID than the 'cactiuser' user that my previous package had used). So I fixed that and waiting for the poller to run again, but still no updates to the rra directory. I thought I'd check that rrdtool was working, so I tried to dump out one of the rrd files:

% rrdtool dump /var/www/cacti/rra/blah.rrd
ERROR: This RRD was created on other architecture

Indeed, in this move I had gone from RHEL 4 x86 to RHEL 5 x86_64. I suppose I could have gone back to the old machine and exported the data and blah blah, but I just blew away all of the files in the rra directory and the next time the poller ran it created new rrds and all seems happy now.
I had to install Firefox on a Red Hat Enterprise Linux 5 server to run the VMware Server web UI. I did a 'yum install firefox', which pulled in a bunch of dependencies. But firefox wouldn't start:

% firefox
No fonts found; this probably means that the fontconfig library is not correctly configured. You may need to edit the fonts.conf configuration file. More information about fontconfig can be bound in the fontconfig(3) manual page and on

As these things go, of course fontconfig was installed. So I did a 'yum list | grep font' and more-or-less started randomly installing packages until Firefox worked. The one that seemed to do the trick was xorg-x11-fonts-Type1

Monday, June 02, 2008

I'm working on enhancing nVentory to meet my employer's needs for an operations database. I'm learning Ruby on Rails in the process and encountering a number of situations that seem poorly documented online. I'm going to try to capture some of these here for posterity. I'm starting this somewhat after the fact (having been working on this project for 5 or 6 weeks now), so these aren't necessarily in the order I encountered them.

First up, problems with connecting to an LDAP server. I started with the snippit of code in the "How is it then used?" section of Since the LDAP servers I'm talking to are Microsoft Active Directory servers I figured I'd automagically figure out which server to talk to via the DNS SRV records that AD publishes:

require 'resolv'
require 'net/ldap'

res = Resolv::DNS::new()
ldapsrv = res.getresource('', Resolv::DNS::Resource::IN::SRV)
ldap = :host =>, ...

That was failing with an exception:

Net::LDAP::LdapError (no connection to server):
/Library/Ruby/Gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1021:in `initialize'

Unfortunately the code in Net::LDAP eats the real exception and throws its own generic "no connection to server" exception in the face of any problems creating the TCP connection to the server. I suppose I could have used the debugger to break on the rescue statement, but I just hacked in a "puts" into the library to see that the real exception was:

can't convert Resolv::DNS::Name into String

Bah humbug. is a Resolv::DNS::Name, which has a to_s method. So change the to:

ldap = :host =>, ...