+ if ($rrd_result) {
+ print "Error while graphing: " . $rrd_result . "\n";
+ } else {
+ my $newmtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9];
+ if ((!defined($mtime)) || ($newmtime != $mtime)) {
+ copy("${outdir}/${hostname}.${var}.week.png.work", "${outdir}/${hostname}.${var}.week.png.new");
+ rename("${outdir}/${hostname}.${var}.week.png.new", "${outdir}/${hostname}.${var}.week.png");
+ }
+ }
+
+ print HTML2 "<img src=\"${hostname}.${var}.week.png\" width=\"${width}\" height=\"${height}\"><br>\n";
+
+ $mtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
+
+ my @yearGraphDef = @graphdef;
+ push @yearGraphDef, @{cfgToGraphDef($graphConfig->{'year'}, ${var}, 3)};
+
+ ($averages, $width, $height) =
+ rrd_graph("${outdir}/${hostname}.${var}.year.png.work",
+ "-w", "$graphWidth", "-e", "00:00", "-s", "end-365d", @yearGraphDef);
+
+ if ($rrd_result) {
+ print "Error while graphing: " . $rrd_result . "\n";
+ } else {
+ my $newmtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
+ if ((!defined($mtime)) || ($newmtime != $mtime)) {
+ copy("${outdir}/${hostname}.${var}.year.png.work", "${outdir}/${hostname}.${var}.year.png.new");
+ rename("${outdir}/${hostname}.${var}.year.png.new", "${outdir}/${hostname}.${var}.year.png");
+ }
+ }
+
+ print HTML2 "<img src=\"${hostname}.${var}.year.png\" width=\"${width}\" height=\"${height}\"><br>\n";
+
+ print HTML2 "</body></html>\n";
+ close(HTML2);
+ rename("${outdir}/${hostname}.${var}.html.new", "${outdir}/${hostname}.${var}.html");
+ }