Author |
Message |
md10md
|
Posted: Fri May 25, 2007 10:01 pm |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
Looks like it's almost working but I'm getting some errors.
Quote: Error: RRDs::graph failed for 'day' : width below 10 pixels
It does this for day, week, month, and year. Any thoughts?
|
|
Top |
|
|
mihanson
|
Posted: Sat May 26, 2007 9:22 am |
|
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location:
Los Angeles
|
Delete your HDtemp.rrd database and all the .png files assocated with it and try again. I never saw that error, so I can't say specificly whats causing it. You can also try to add some perl debugging switches.
At the top Code: #!/usr/bin/perl -wc will check your syntax, but not actually execute the script. You may get some warnings about colors being used only once, but they're harmless. In the end it should say:
Quote: /usr/local/bin/rrd_HDtemp.pl syntax OK
If you copy and pasted my script, you may have a line wrap problem somewhere.
_________________ Mike
My Hardware Profile
|
|
Top |
|
|
md10md
|
Posted: Sat May 26, 2007 9:27 am |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
Running without the error checking switch gets this:
Quote: root@mythtv:/usr/local/bin# rrd_HDtemp.pl Create db for /myth/logs/rrd/HDtemp => //myth/logs/rrd/HDtemp.rrd HDtemp sda: 'ST3320620AS' '32 C' HDtemp sdb: 'ST3320620AS' '32 C' Error: RRDs::graph failed for 'day' : width below 10 pixels Error: RRDs::graph failed for 'week' : width below 10 pixels Error: RRDs::graph failed for 'month' : width below 10 pixels Error: RRDs::graph failed for 'year' : width below 10 pixels
As you can see it gets the temperatures all right but after that it goes bad. Here's what I get with the -wc switch: Quote: root@mythtv:/usr/local/bin# rrd_HDtemp.pl Name "main::Gwd" used only once: possible typo at /usr/local/bin/rrd_HDtemp.pl l ine 99. Name "main::color_hdt1" used only once: possible typo at /usr/local/bin/rrd_HDte mp.pl line 112. Name "main::png" used only once: possible typo at /usr/local/bin/rrd_HDtemp.pl l ine 98. Name "main::color_hdt2" used only once: possible typo at /usr/local/bin/rrd_HDte mp.pl line 117. Name "main::Ght" used only once: possible typo at /usr/local/bin/rrd_HDtemp.pl l ine 99. /usr/local/bin/rrd_HDtemp.pl syntax OK
|
|
Top |
|
|
md10md
|
Posted: Sat May 26, 2007 9:29 am |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
Also, I can't find in the script where it is trying to export the png files. Could that be the root of the problem?
|
|
Top |
|
|
mihanson
|
Posted: Sun May 27, 2007 11:24 am |
|
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location:
Los Angeles
|
md10md wrote: Also, I can't find in the script where it is trying to export the png files. Could that be the root of the problem?
Post your script and let's see what's going on... I just copy and pasted what I posted to a new file and ran a diff on it with the script I have working and it all matches up.
_________________ Mike
My Hardware Profile
|
|
Top |
|
|
md10md
|
Posted: Sun May 27, 2007 11:42 am |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
Here it is
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 # ######################################################################## # Configuration: my $dbf = '/myth/logs/rrd/HDtemp'; my $configfile = '/usr/local/bin/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", "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, $hdtT1, $hdtT2, $hdtD1, $hdtD2);
################################################################### #### 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"; } }
################################################ #### Added hdt2 to the update routine below #### ################################################ sub update { # $_[0] = filename RRDs::update( "$log/$_[0].rrd", "-t", "hdt1:hdt2", "N:$hdt1:$hdt2"); $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 ($hdtD1/$hdtD2) 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", "LINE2: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", "LINE2: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"); $ERROR = RRDs::error; print "Error: RRDs::graph failed for '$_[0]' : $ERROR\n" if $ERROR; } ######################################################################## create "$dbf"; ##################################################### #### Changed '$dev' to '$dev1' and added '$dev2' #### #### to gather below. #### ##################################################### gather "$dev1", "$dev2"; update "$dbf"; graph 'day', 'Daily'; graph 'week', 'Weekly'; graph 'month', 'Monthly'; graph 'year', 'Yearly'; ######################################################################## # vim: sw=4 ts=8 # End
|
|
Top |
|
|
tjc
|
Posted: Sun May 27, 2007 3:37 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
If you really have a blank line at the beginning the #! magic won't be seen. Also, did you run chmod +rx /usr/local/bin/rrd_HDtemp.pl to make sure it had the correct permissions?
|
|
Top |
|
|
md10md
|
Posted: Sun May 27, 2007 3:41 pm |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
Blank line was there just because I put the script after the [code] line, not on it. Permissions are right. This is annoying because I'd love to have these combined.
|
|
Top |
|
|
tjc
|
Posted: Sun May 27, 2007 4:19 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
These are the diffs I see versus the previously posted script:
Code: root@black2:~# diff -dw rrd_HDtemp.pl ddd 11,12c11,12 < my $dbf = 'HDtemp'; < my $configfile = '/etc/rrd.config'; --- > my $dbf = '/myth/logs/rrd/HDtemp'; > my $configfile = '/usr/local/bin/rrd.config'; 102c102 < "--color", "BACK$color", --- > "--color", "BACK#$color", 140,152d139 < < < Code: < < /etc/rrd.config < #======================================================================= < # rrd_HDtemp.pl config: # hard disk temperature < #----------------------------------------------------------------------- < $dev1 = 'sda'; # Disk being measured < $dev2 = 'sdb'; # Disk being measured < $color_hdt1 = '#0000FF'; # color of temperature graph line < $color_hdt2 = '#00FF00'; # color of temperature graph line < #======================================================================= \ No newline at end of file root@black2:~# diff -dw rrd_HDtemp.pl ddd 11,12c11,12 < my $dbf = 'HDtemp'; < my $configfile = '/etc/rrd.config'; --- > my $dbf = '/myth/logs/rrd/HDtemp'; > my $configfile = '/usr/local/bin/rrd.config'; 102c102 < "--color", "BACK$color", --- > "--color", "BACK#$color", 140,152d139 < < < Code: < < /etc/rrd.config < #======================================================================= < # rrd_HDtemp.pl config: # hard disk temperature < #----------------------------------------------------------------------- < $dev1 = 'sda'; # Disk being measured < $dev2 = 'sdb'; # Disk being measured < $color_hdt1 = '#0000FF'; # color of temperature graph line < $color_hdt2 = '#00FF00'; # color of temperature graph line < #=======================================================================
|
|
Top |
|
|
md10md
|
Posted: Sun May 27, 2007 5:27 pm |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
I just recopied the script and it is still not working unfortunately. Could it be my rrdtools version? I'm running R5E50 so it is relatively recent.
|
|
Top |
|
|
mihanson
|
Posted: Sun May 27, 2007 7:53 pm |
|
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location:
Los Angeles
|
md10md wrote: Here it is 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 # ######################################################################## # Configuration: my $dbf = '/myth/logs/rrd/HDtemp'; my $configfile = '/usr/local/bin/rrd.config';
Are you sure the above 2 my variables are right? Default is to have the config file as Code: my $configfile = '/etc/rrd.config'; . my $dbf should be simply Code: my $dbf = 'HDtemp'; My script is based on the R5F1 defaults. If you placed your files in a nonstandard place, (or are using another version of KM, as I see you're running R5E50) then you'll have to go thru and figure out what your settings may have broken.
tjc, did this script work for you?
_________________ Mike
My Hardware Profile
|
|
Top |
|
|
tjc
|
Posted: Sun May 27, 2007 9:00 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
mihanson wrote: tjc, did this script work for you?
I haven't had a chance to try it. I need to figure out how it works and fiddle with the drive names for starters.
BTW, md10md - In terms of rrd_tool there's a huge distance between R5E50 and R5F1. Dale did at least one major overhaul then there were a series of tweeks on top of that. The parts aren't really interchangable.
|
|
Top |
|
|
md10md
|
Posted: Sun May 27, 2007 9:02 pm |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
tjc wrote: mihanson wrote: tjc, did this script work for you? I haven't had a chance to try it. I need to figure out how it works and fiddle with the drive names for starters. BTW, md10md - In terms of rrd_tool there's a huge distance between R5E50 and R5F1. Dale did at least one major overhaul then there were a series of tweeks on top of that. The parts aren't really interchangable.
Was it the scripts or rrdtool itself? The scripts should be interchangeable as far as I know.
Edit: I updated rrdtool to the latest version and changed options back to the defaults (log locations and db location) and it still doesn't work. I'm beginning to think it really just is an R5F1 issue.
Last edited by md10md on Sun May 27, 2007 9:08 pm, edited 1 time in total.
|
|
Top |
|
|
tjc
|
Posted: Sun May 27, 2007 9:07 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Scripts, the names of the DB and image files, the web index, ... Possibly even the version of the underlying package. All the integration points have shifted. You'll be doing so much cutting and fitting that it will end up as completely custom script.
|
|
Top |
|
|