If you google 'rrd mythtv' you will get several hits that will give you examples of changes to display multiple hd temps and usage among others (also see
http://www.knoppmyth.net/phpBB2/viewtopic.php?t=15957). I have included some of my changes as examples. Below is my /usr/local/bin/rrd_HDtemp.pl changes to display a total of 4 hd temps. The pertinent section of rrd.config follows. Oh, make sure you reset the logs of whatever device you change (in this example rename /myth/rrd/log/HDtemp.rrd).
Code:
#!/usr/bin/perl
#
# rrd_HDtemp.pl
# Disk temperature data collection routine for KnoppMyth
#
# Edited to add second hard drive monitor
# Mike Hanson 05/25/2007
#
# Edited to modify Mike's code to include additional drives, change
# colors and location of graphs - J Ravenel 10/02/07
########################################################################
# Configuration:
my $dbf = 'HDtemp';
my $configfile = '/etc/rrd.config';
########################################################################
use RRDs;
if (! -d "/myth") { $configfile = "./D_rrd.config"; } # DEBUG
do $configfile;
sub create {
# $_[0] = filename
if (! -e "$log/$_[0].rrd") {
print "Create db for $_[0] => $log/$_[0].rrd\n";
RRDs::create( "$log/$_[0].rrd", "-s 300",
"DS:hdt1:GAUGE:600:0:U",
####################################
#### Added the second DS below #####
####################################
"DS:hdt2:GAUGE:600:0:U",
"DS:hdt3:GAUGE:600:0:U",
"DS:hdt4:GAUGE:600:0:U",
"RRA:AVERAGE:0.5:1:576",
"RRA:AVERAGE:0.5:6:672",
"RRA:AVERAGE:0.5:24:732",
"RRA:AVERAGE:0.5:144:1460");
$ERROR = RRDs::error;
print "Error: RRDs::create failed for '$_[0]' : $ERROR\n" if $ERROR;
}
}
##########################################
#### Added second set of $hdt?n below ####
##########################################
my ($hdt1, $hdt2, $hdt3, $hdt4, $hdtT1, $hdtT2, $hdtT3, $hdtT4, $hdtD1, $hdtD2, $hdtD3, $hdtD4);
###################################################################
#### I run the script in sub gather below one time per device. ####
#### There may be a more elegant way to do this, but it works. ####
###################################################################
sub gather {
{ # $_[0] device name
my $line1 = `/usr/sbin/hddtemp -q /dev/$_[0]`;
chomp( $line1 );
my ( $devN1, $devD1, $devT1 ) = split( /\:\s+/, $line1 );
#print "HDtemp $_[0]: '$devN1' '$devD1' '$devT1'\n";
my ( $dev11, $dev21 ) = split( /\s+or\s+/, $devT1 );
#print "HDtemp $_[0]: '$dev11' '$dev21'\n";
( $hdt1, $hdtT1 ) = split( /\s+/, $dev11 );
#print "HDtemp $_[0]: '$hdt1' '$hdtT1'\n";
if ($devN1 ne "/dev/$_[0]") {
$hdt1 = 0; $hdtT1 = '?'; $hdtD1 = '';
} else {
$hdtD1 = $devD1;
}
if ("$hdtT1" eq "") {$hdt1 = "C"; }
print "HDtemp $_[0]: '$hdtD1' '$hdt1 $hdtT1'\n";
}
{ # $_[1] device name
my $line2 = `/usr/sbin/hddtemp -q /dev/$_[1]`;
chomp( $line2 );
my ( $devN2, $devD2, $devT2 ) = split( /\:\s+/, $line2 );
#print "HDtemp $_[1]: '$devN2' '$devD2' '$devT2'\n";
my ( $dev12, $dev22 ) = split( /\s+or\s+/, $devT2 );
#print "HDtemp $_[1]: '$dev12' '$dev22'\n";
( $hdt2, $hdtT2 ) = split( /\s+/, $dev12 );
#print "HDtemp $_[1]: '$hdt2' '$hdtT2'\n";
if ($devN2 ne "/dev/$_[1]") {
$hdt2 = 0; $hdtT2 = '?'; $hdtD2 = '';
} else {
$hdtD2 = $devD2;
}
if ("$hdtT2" eq "") {$hdt2 = "C"; }
print "HDtemp $_[1]: '$hdtD2' '$hdt2 $hdtT2'\n";
}
{ # $_[2] device name
my $line3 = `/usr/sbin/hddtemp -q /dev/$_[2]`;
chomp( $line3 );
my ( $devN3, $devD3, $devT3 ) = split( /\:\s+/, $line3 );
#print "HDtemp $_[2]: '$devN3' '$devD3' '$devT3'\n";
my ( $dev13, $dev23 ) = split( /\s+or\s+/, $devT3 );
#print "HDtemp $_[2]: '$dev13' '$dev23'\n";
( $hdt3, $hdtT3 ) = split( /\s+/, $dev13 );
#print "HDtemp $_[2]: '$hdt3' '$hdtT3'\n";
if ($devN3 ne "/dev/$_[2]") {
$hdt3 = 0; $hdtT3 = '?'; $hdtD3 = '';
} else {
$hdtD3 = $devD3;
}
if ("$hdtT3" eq "") {$hdt3 = "C"; }
print "HDtemp $_[2]: '$hdtD3' '$hdt3 $hdtT3'\n";
}
{ # $_[3] device name
my $line4 = `/usr/sbin/hddtemp -q /dev/$_[3]`;
chomp( $line4 );
my ( $devN4, $devD4, $devT4 ) = split( /\:\s+/, $line4 );
#print "HDtemp $_[3]: '$devN4' '$devD4' '$devT4'\n";
my ( $dev14, $dev24 ) = split( /\s+or\s+/, $devT4 );
#print "HDtemp $_[3]: '$dev14' '$dev24'\n";
( $hdt4, $hdtT4 ) = split( /\s+/, $dev14 );
#print "HDtemp $_[3]: '$hdt4' '$hdtT4'\n";
if ($devN4 ne "/dev/$_[3]") {
$hdt4 = 0; $hdtT4 = '?'; $hdtD4 = '';
} else {
$hdtD4 = $devD4;
}
if ("$hdtT4" eq "") {$hdt4 = "C"; }
print "HDtemp $_[3]: '$hdtD4' '$hdt4 $hdtT4'\n";
}
}
################################################
#### Added hdt2 to the update routine below ####
################################################
sub update {
# $_[0] = filename
RRDs::update( "$log/$_[0].rrd", "-t",
"hdt1:hdt2:hdt3:hdt4",
"N:$hdt1:$hdt2:$hdt3:$hdt4");
$ERROR = RRDs::error;
print "Error: RRDs::update for '$_[0]' : $ERROR\n" if $ERROR;
}
sub graph {
# $_[0] = time interval (ie: day...)
# $_[1] = filename suffix.
RRDs::graph( "$png/$dbf-$_[1].png", "-s -1$_[0]", "-aPNG",
"-w $Gwd", "-h $Ght", "-E", "-l 20", "-M",
"--color", "SHADEA$color",
"--color", "SHADEB$color",
"--color", "BACK$color",
# "-t Disk $dev1/$dev2/$dev3/$dev4 ($hdtD1/$hdtD2/$hdtD3/$hdtD4) temp :: $_[0]",
"-t Disk $dev1/$dev2/$dev3/$dev4 temp :: $_[0]",
"DEF:hdt1=$log/$dbf.rrd:hdt1:AVERAGE",
############################################
#### Added second DEF for hdt2 below. ####
#### Added second $color_hdt variable. ####
#### Changed LINE1 to LINE2 for thicker ####
#### lines on the graphs. ####
############################################
"DEF:hdt2=$log/$dbf.rrd:hdt2:AVERAGE",
"DEF:hdt3=$log/$dbf.rrd:hdt3:AVERAGE",
"DEF:hdt4=$log/$dbf.rrd:hdt4:AVERAGE",
"LINE1:hdt1$color_hdt1: $dev1 degrees $hdtT1\\:",
"GPRINT:hdt1:MIN:Minimum\\: %.0lf",
"GPRINT:hdt1:MAX:Maximum\\: %.0lf",
"GPRINT:hdt1:AVERAGE:Average\\: %.2lf",
"GPRINT:hdt1:LAST:Current\\: %.1lf\\j",
"LINE1:hdt2$color_hdt2: $dev2 degrees $hdtT2\\:",
"GPRINT:hdt2:MIN:Minimum\\: %.0lf",
"GPRINT:hdt2:MAX:Maximum\\: %.0lf",
"GPRINT:hdt2:AVERAGE:Average\\: %.2lf",
"GPRINT:hdt2:LAST:Current\\: %.1lf\\j",
"LINE1:hdt3$color_hdt3: $dev3 degrees $hdtT3\\:",
"GPRINT:hdt3:MIN:Minimum\\: %.0lf",
"GPRINT:hdt3:MAX:Maximum\\: %.0lf",
"GPRINT:hdt3:AVERAGE:Average\\: %.2lf",
"GPRINT:hdt3:LAST:Current\\: %.1lf\\j",
"LINE1:hdt4$color_hdt4: $dev4 degrees $hdtT4\\:",
"GPRINT:hdt4:MIN:Minimum\\: %.0lf",
"GPRINT:hdt4:MAX:Maximum\\: %.0lf",
"GPRINT:hdt4:AVERAGE:Average\\: %.2lf",
"GPRINT:hdt4:LAST:Current\\: %.1lf\\j");
$ERROR = RRDs::error;
print "Error: RRDs::graph failed for '$_[0]' : $ERROR\n" if $ERROR;
}
########################################################################
create "$dbf";
#####################################################
#### Changed '$dev' to '$dev1' and added '$dev2' ####
#### '$dev3' ,etc... to gather below. ####
#####################################################
gather "$dev1", "$dev2", "$dev3", "$dev4";
update "$dbf";
graph 'day', 'Daily';
graph 'week', 'Weekly';
graph 'month', 'Monthly';
graph 'year', 'Yearly';
########################################################################
# vim: sw=4 ts=8
# End
Code:
#=======================================================================
# rrd_HDtemp.pl config: # hard disk temperature
#-----------------------------------------------------------------------
$dev1 = 'hda'; # Disk being measured
$dev2 = 'hdb'; # Disk being measured
$dev3 = 'sda'; # Disk being measured
$dev4 = 'sdb'; # Disk being measured
$color_hdt1 = '#0000FF'; # color of temperature graph line
$color_hdt2 = '#00FF00'; # color of temperature graph line
$color_hdt3 = '#FF0000'; # color of temperature graph line
$color_hdt4 = '#FFFF00'; # color of temperature graph line