--- hddtemp_smartctl.orig 2009-04-07 21:40:17.000000000 +0900 +++ hddtemp_smartctl 2009-04-07 21:47:37.000000000 +0900 @@ -80,6 +80,12 @@ use strict; +sub internal_name { + my $dev = shift; + $dev =~ s|[-/.]|_|g; + return $dev; +} + my $smartctl = exists $ENV{smartctl} ? $ENV{smartctl} : undef; # If the envvar is not set, look for smartctl @@ -138,7 +144,7 @@ print "graph_vlabel temp in °C\n"; print "graph_category sensors\n"; print "graph_info This graph shows the temperature in degrees Celsius of the hard drives in the machine.\n"; - print "$_.label $_\n" foreach @drives; + print internal_name($_) .".label $_\n" foreach @drives; exit 0; } } @@ -156,10 +162,11 @@ } my $output = `$cmd`; + my $name = internal_name($_); if ($output =~ /Current Drive Temperature:\s*(\d+)/) { - print "$_.value $1\n"; + print "$name.value $1\n"; } elsif ($output =~ /^(194 Temperature_Celsius.*)/m) { my @F = split ' ', $1; - print "$_.value $F[9]\n"; + print "$name.value $F[9]\n"; } }