| 219 | | sub calculate_png_size |
|---|
| 220 | | { |
|---|
| 221 | | my $config = shift; |
|---|
| 222 | | my $domain = shift; |
|---|
| 223 | | my $node = shift; |
|---|
| 224 | | my $serv = shift; |
|---|
| 225 | | |
|---|
| 226 | | # base size of graph rectangle + space outside graph rectangle |
|---|
| 227 | | my $height = munin_get ($config, "graph_height", 100, $domain, $node, $serv) + 156; |
|---|
| 228 | | my $width = munin_get ($config, "graph_width" , 400, $domain, $node, $serv) + 93; |
|---|
| 229 | | |
|---|
| 230 | | # In addition, the height increases by 15 pixels for each label underneath |
|---|
| 231 | | foreach my $field (keys %{$config->{domain}->{$domain}->{node}->{$node}->{client}->{$serv}}) |
|---|
| 232 | | { |
|---|
| 233 | | if ($field =~ /^([^\.]+)\.label/) |
|---|
| 234 | | { |
|---|
| 235 | | if (munin_draw_field ($config->{domain}->{$domain}->{node}->{$node}, $serv, $1)) |
|---|
| 236 | | { |
|---|
| 237 | | $height += 15; |
|---|
| 238 | | my $tmpline = munin_get ($config, "line", undef, $domain, $node, $serv, $1); |
|---|
| 239 | | if ($tmpline) |
|---|
| 240 | | { |
|---|
| 241 | | my @tmparr = ($tmpline =~ /:/g); |
|---|
| 242 | | if (scalar (@tmparr) > 2) |
|---|
| 243 | | { # We've got line definitions with labels... |
|---|
| 244 | | $height += 15; |
|---|
| 245 | | } |
|---|
| 246 | | } |
|---|
| 247 | | } |
|---|
| 248 | | } |
|---|
| 249 | | } |
|---|
| 250 | | # ...and +15 if there's a graph total |
|---|
| 251 | | $height += 15 if (munin_get ($config, "graph_total", undef, $domain, $node, $serv)); |
|---|
| 252 | | # ...and +15 if there's min/max-headers above the labels |
|---|
| 253 | | $height += 15 if (munin_graph_column_headers ($config, $domain, $node, $serv)); |
|---|
| 254 | | |
|---|
| 255 | | return ($width, $height); |
|---|
| 256 | | } |
|---|
| 257 | | |
|---|
| 585 | | if (munin_get_bool ($service, "graph_sums", 0)) { |
|---|
| 586 | | $srv{imgweeksum} = "$srv{node}-week-sum.png"; |
|---|
| 587 | | $srv{imgyearsum} = "$srv{node}-year-sum.png"; |
|---|
| 588 | | for my $scale (["week", "year"]) { |
|---|
| 589 | | if (my ($w, $h) = get_png_size (munin_get_picture_filename($service, $scale, 1))) { |
|---|
| | 549 | if (munin_get_bool ($service, "graph_sums", 0)) { |
|---|
| | 550 | $srv{imgweeksum} = "$srv{node}-week-sum.png"; |
|---|
| | 551 | $srv{imgyearsum} = "$srv{node}-year-sum.png"; |
|---|
| | 552 | for my $scale (["week", "year"]) { |
|---|
| | 553 | if (my ($w, $h) = get_png_size (munin_get_picture_filename($service, $scale, 1))) { |
|---|
| | 554 | if ($w and $h) { |
|---|