Changeset 2735

Show
Ignore:
Timestamp:
10/28/09 02:25:23 (2 years ago)
Author:
janl
Message:

* munin-html: Do not try to calculate png size, use geometry of the file in the filesystem instead. This will cause a propagation delay - image sizes _may_ be wrong, until munin-html runs again.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/master/_bin/munin-html.in

    r2215 r2735  
    169169 
    170170munin_removelock("$config->{rundir}/munin-html.lock"); 
    171  
    172 sub calculate_png_size 
    173 { 
    174         my $config = shift; 
    175         my $domain = shift; 
    176         my $node   = shift; 
    177         my $serv   = shift; 
    178  
    179         # base size of graph rectangle + space outside graph rectangle 
    180         my $height = munin_get ($config, "graph_height", 100, $domain, $node, $serv) + 156; 
    181         my $width  = munin_get ($config, "graph_width" , 400, $domain, $node, $serv) + 93; 
    182  
    183         # In addition, the height increases by 15 pixels for each label underneath 
    184         foreach my $field (keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}->{$serv}}) 
    185         { 
    186             if ($field =~ /^([^\.]+)\.label/) 
    187             { 
    188                 if (munin_draw_field ($config->{domain}->{$domain}->{node}->{$node}, $serv, $1)) 
    189                 { 
    190                     $height += 15; 
    191                     my $tmpline = munin_get ($config, "line", undef, $domain, $node, $serv, $1); 
    192                     if ($tmpline) 
    193                     { 
    194                         my @tmparr = ($tmpline =~ /:/g); 
    195                         if (scalar (@tmparr) > 2) 
    196                         { # We've got line definitions with labels... 
    197                             $height += 15; 
    198                         } 
    199                     } 
    200                 } 
    201             } 
    202         } 
    203         # ...and +15 if there's a graph total 
    204         $height += 15 if (munin_get ($config, "graph_total", undef, $domain, $node, $serv)); 
    205         # ...and +15 if there's min/max-headers above the labels 
    206         $height += 15 if (munin_graph_column_headers ($config, $domain, $node, $serv)); 
    207  
    208         return ($width, $height); 
    209 } 
    210171 
    211172sub get_png_size 
     
    586547        $srv{'cimgmonth'}="$bp/$parent/$srv{node}-month.png"; 
    587548        $srv{'cimgyear'} ="$bp/$parent/$srv{node}-year.png"; 
    588  
    589         for my $scale (@times) { 
    590            if (my ($w, $h) = get_png_size(munin_get_picture_filename($service, $scale))) { 
    591                $srv{"img".$scale."width"} = $w; 
    592                $srv{"img".$scale."height"} = $h
    593             } 
    594         } 
    595  
    596         if (munin_get_bool ($service, "graph_sums", 0)) { 
    597             $srv{imgweeksum} = "$srv{node}-week-sum.png"; 
    598             $srv{imgyearsum} = "$srv{node}-year-sum.png"; 
    599             for my $scale (["week", "year"]) { 
    600                if (my ($w, $h) = get_png_size (munin_get_picture_filename($service, $scale, 1))) { 
    601                    $srv{"img".$scale."sumwidth"} = $w; 
    602                     $srv{"img".$scale."sumheight"} = $h
    603                 } 
     549    } 
     550 
     551    for my $scale (@times) { 
     552        if (my ($w, $h) = get_png_size(munin_get_picture_filename($service, $scale))) { 
     553            $srv{"img".$scale."width"} = $w
     554            $srv{"img".$scale."height"} = $h; 
     555        } 
     556    } 
     557 
     558    if (munin_get_bool ($service, "graph_sums", 0)) { 
     559        $srv{imgweeksum} = "$srv{node}-week-sum.png"; 
     560        $srv{imgyearsum} = "$srv{node}-year-sum.png"; 
     561        for my $scale (["week", "year"]) { 
     562            if (my ($w, $h) = get_png_size (munin_get_picture_filename($service, $scale, 1))) { 
     563                $srv{"img".$scale."sumwidth"} = $w
     564                $srv{"img".$scale."sumheight"} = $h; 
    604565            } 
    605566        }