3Ware S.M.A.R.T. temperature monitoring

I thought setting up temperature monitoring ought to be pretty simple. I had always simply used smartctl before and it just worked with the 3Ware option. Well, not so anymore. With the recent changes in SCSI ioctls in 2.6 kernels, a bunch of stuff has broken in strange and magical ways.

I ended up getting the latest smartmontools, v5.33, from Debian experimental and installing that. It understands how to speak to the new /dev/twe0 character devices. The latest 3dmd and commandline client for 3Ware’s 7000, 8000, and 9000 series cards creates these automatically in /dev for you.

Next I fetched a neat Munin plugin that queries smartctl for temperature information and is happy to work with 3Ware cards using the -d argument. I emailed the author, Lupe Christoph, and he worked out some changes so it would work with 3Ware’s character devices. The changes to the last foreach loop are below.

foreach (@drives) {
  my $dev;
  $dev = $_ =~ /(.*)(?:_d+)/ ? $1 : $_;
  my $cmd = $smartctl.' -A '.(exists $ENV{'type_'.$_} ? '-d '.$ENV{'type_'.$_}.' ' : '')."/dev/$dev";

All that’s missing now is an entry in /etc/munin/plugin-conf.d/munin-node.

[hddtemp_smartctl]
user root
env.drives twe0_0 twe0_1
env.type_twe0_0 3ware,0
env.type_twe0_1 3ware,1

Now I have temperature information for the drives which supply it. Excellent.