+ my @graphdef = ("-t", $vars->{$var}->{'name'}, "DEF:${var}=${rrdfile}:${var}:AVERAGE", "LINE1:${var}#FF0000");
+ (my $averages, my $width, my $height) =
+ RRDs::graph("${outdir}/${var}.png.new",
+ "-w", "720", @graphdef);
+
+ if (RRDs::error) {
+ print "Error while graphing: " . RRDs::error . "\n";
+ } else {
+ rename("${outdir}/${var}.png.new", "${outdir}/${var}.png");
+ }
+
+ print HTML "<a href=\"${var}.html\"><img src=\"${var}.png\" width=\"${width}\" height=\"${height}\" border=\"0\"></a>";
+
+ open (HTML2, ">${outdir}/${var}.html.new");
+ print HTML2 "<html><head><title>" . $vars->{$var}->{'name'} . "</title></head>";
+ print HTML2 '<body bgcolor="#ffffff">';
+
+ ($averages, $width, $height) =
+ RRDs::graph("${outdir}/${var}.long.png.new",
+ "-w", "1008", @graphdef);
+
+ if (RRDs::error) {
+ print "Error while graphing: " . RRDs::error . "\n";
+ } else {
+ rename("${outdir}/${var}.long.png.new", "${outdir}/${var}.long.png");
+ }
+
+ print HTML2 "<img src=\"${var}.long.png\" width=\"${width}\" height=\"${height}\"><br>";
+
+ ($averages, $width, $height) =
+ RRDs::graph("${outdir}/${var}.week.png.new",
+ "-w", "1008", "-e", "now", "-s", "end-1w", @graphdef);
+
+ if (RRDs::error) {
+ print "Error while graphing: " . RRDs::error . "\n";
+ } else {
+ rename("${outdir}/${var}.week.png.new", "${outdir}/${var}.week.png");
+ }
+
+ print HTML2 "<img src=\"${var}.week.png\" width=\"${width}\" height=\"${height}\"><br>";
+
+ ($averages, $width, $height) =
+ RRDs::graph("${outdir}/${var}.year.png.new",
+ "-w", "1008", "-e", "now", "-s", "end-1y", @graphdef);
+
+ if (RRDs::error) {
+ print "Error while graphing: " . RRDs::error . "\n";
+ } else {
+ rename("${outdir}/${var}.year.png.new", "${outdir}/${var}.year.png");
+ }