[pve-devel] RRD graphics in webfrontend broken
Stefan Priebe
s.priebe at profihost.ag
Tue Oct 30 20:13:42 CET 2012
Am 30.10.2012 18:14, schrieb Dietmar Maurer:
>> I think it's here :
>>
>> /usr/share/perl5/PVE/Cluster.pm
>>
>> sub create_rrd_graph {
>
> I guess I have also seen that.
>
> The big plan is to use ExtJS graph feature to display rrd data. But
> that is a considerable amount of work (debug ExtJS code).
nice but i can't do this.
But here is a fix for the problem. The problem is that we write to ONE
.png file ALL graphs for different ds. So this splits the destination
.png file per ds. Also it fixes the problem where ExtJS / the browser
loads a .png file which is not fully written by using a tmp file and
then rename it.
--- /usr/share/perl5/PVE/Cluster.pm 2012-09-24 06:07:04.000000000 +0200
+++ Cluster.pm 2012-10-30 20:08:52.355973920 +0100
@@ -670,7 +670,7 @@ sub create_rrd_graph {
my $rrd = "$rrddir/$rrdname";
- my $filename = "$rrd.png";
+ my $filename = "${rrd}_$ds.png";
my $setup = {
hour => [ 60, 60 ],
@@ -714,11 +714,12 @@ sub create_rrd_graph {
push @args, '--full-size-mode';
- RRDs::graph($filename, @args);
+ RRDs::graph($filename.".tmp", @args);
my $err = RRDs::error;
die "RRD error: $err\n" if $err;
+ rename $filename.".tmp", $filename;
return { filename => $filename };
}
Stefan
More information about the pve-devel
mailing list